Image coding / decoding method and apparatus using in-loop filtering

By adopting in-loop filtering technology in video encoding/decoding, using subsampled block classification and multiple filter shapes, the problems of computing complexity and high memory bandwidth during high-resolution video encoding are solved, and more efficient video encoding and decoding is achieved, and picture distortion is reduced.

CN115802034BActive Publication Date: 2025-06-03INTELLECTUAL DISCOVERY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211663804.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-10-29
Filing Date
2018-11-29
Publication Date
2025-06-03
Estimated Expiration
2038-11-29

Smart Images

  • Figure CN115802034B_ABST
    Figure CN115802034B_ABST
Patent Text Reader

Abstract

The present invention provides an image encoding / decoding method and apparatus using in-loop filtering. Among them, the image encoding / decoding method and apparatus adopt a plurality of filter modes to reduce the computational complexity, the required memory capacity, and the memory access bandwidth. The image decoding method according to the present disclosure includes: a step of decoding filter information regarding an encoding unit; a step of classifying the encoding unit by a block classification unit; and a step of filtering the encoding unit classified by the block classification unit by using the filter information.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of Application No. 201880086848.7, titled "Image Coding / Decoding Method and Apparatus Using In-Loop Filtering", filed with the China National Intellectual Property Administration on November 29, 2018. Technical Field

[0002] The present invention relates to a video coding / decoding method, a video coding / decoding device, and a recording medium storing a bitstream. Specifically, the present invention relates to a video coding / decoding method and device using in-loop filtering. Background Art

[0003] Currently, in various applications, the demand for high-resolution and high-quality videos such as high-definition (HD) videos and ultra-high-definition (UHD) videos is increasing. As videos have higher resolutions and qualities, the amount of video data increases compared to existing video data. Therefore, when transmitting video data through a medium such as a wired / wireless broadband line or storing video data in an existing storage medium, the transmission or storage cost increases. To solve the problem of high-resolution and high-quality video data, highly efficient video coding / decoding techniques are required.

[0004] There are various video compression techniques, such as an inter-frame prediction technique for predicting pixel values within a current picture from pixel values within a previous picture or a subsequent picture, an intra-frame prediction technique for predicting pixel values within a region of a current picture from another region of the current picture, a transform and quantization technique for compressing the energy of a residual signal, and an entropy coding technique for assigning shorter codes to frequently occurring pixel values and longer codes to less frequently occurring pixel values. Using these video compression techniques, video data can be effectively 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, the problem with deblocking filtering is that when filtering block boundaries, deblocking filtering cannot minimize the distortion between the original picture and the reconstructed picture.

[0006] Sample Adaptive Offset (SAO) is a method for reducing ringing artifacts: after comparing the pixel value of a sample with the pixel values of adjacent samples based on each sample, an offset is added to a specific sample, or an offset is added to samples whose pixel values are within a specific pixel value range. SAO has the effect of reducing the distortion between the original picture and the reconstructed picture to some extent by using rate-distortion optimization. However, when the difference between the original picture and the reconstructed picture is large, there are limitations in minimizing the distortion. Summary of the Invention

[0007] Technical Problem

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

[0009] Another object of the present invention is to provide a method and apparatus for performing in-loop filtering using subsampling-based block classification to reduce the computational complexity and memory access bandwidth of a video encoder / decoder.

[0010] Another object of the present invention is to provide a method and apparatus for performing in-loop filtering using multiple filter shapes to reduce the computational complexity, memory capacity requirements, and memory access bandwidth of a video encoder / decoder.

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

[0012] Technical solution

[0013] A video decoding method according to the present invention may include: decoding filter information regarding an encoding unit; classifying samples in the encoding unit into classes based on each block classification unit; and filtering the encoding unit having the samples classified into the classes based on each block classification unit by using the filter information.

[0014] In the video decoding method according to the present invention, the method may further include assigning a block classification index to the encoding unit having the samples classified into classes based on each block classification unit, where the block classification index is determined according to directionality information and activity information.

[0015] In the video decoding method according to the present invention, 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.

[0016] In the video decoding method according to the present invention, the gradient value is obtained by using a one-dimensional Laplacian operation for each block classification unit in the block classification unit.

[0017] In the video decoding method according to the present invention, the one-dimensional Laplacian operation is a one-dimensional Laplacian operation whose operation position is a subsampled position.

[0018] In the video decoding method according to the present invention, the gradient value is determined based on a temporal layer identifier.

[0019] In the video decoding method according to the present invention, the filter information includes at least one piece of information selected from information on whether to perform filtering, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information on whether to use a fixed filter for block classification indexing, and filter symmetry type information.

[0020] In the video decoding method according to the present invention, the filter shape information includes at least one of a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a four-leaf clover shape, a cross shape, a triangle, a pentagon, a hexagon, an octagon, a decagon, and a dodecagon.

[0021] In the video decoding method according to the present invention, the filter coefficient values include filter coefficient values for geometric transformation of the coding unit, where the coding unit has the samples classified into the classes based on each block classification unit.

[0022] In the video decoding method according to the present invention, the filter symmetry type information includes at least one of point symmetry, horizontal symmetry, vertical symmetry, and diagonal symmetry.

[0023] Furthermore, in a video encoding method according to the present invention, the method may include: classifying the samples of the coding unit into classes based on each block classification unit; filtering the coding unit having the samples classified into the classes based on each block classification unit by using the filter information on the coding unit; and encoding the filter information.

[0024] In the video encoding method according to the present invention, the method may further include: assigning a block classification index to the coding unit having the samples classified into the classes based on each block classification unit, where the block classification index is determined based on directionality information and activity information.

[0025] In the video encoding method according to the present invention, at least one of the directionality information and the activity information is determined based on gradient values for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction.

[0026] In the video encoding method according to the present invention, the gradient values are obtained by using a one-dimensional Laplacian operation for each block classification unit in the block classification unit.

[0027] In the video encoding method according to the present invention, the one-dimensional Laplacian operation is a one-dimensional Laplacian operation where the operation position is the subsampled position.

[0028] In the video encoding method according to the present invention, wherein the gradient value is determined based on a temporal layer identifier.

[0029] In the video encoding method according to the present invention, wherein the filter information includes at least one piece of information selected from information on whether to perform filtering, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information on whether to use a fixed filter for block classification indexing, and filter symmetry type information.

[0030] In the video encoding method according to the present invention, wherein the filter shape information includes at least one of a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a four-leaf clover shape, a cross shape, a triangle, a pentagon, a hexagon, an octagon, a decagon, and a dodecagon.

[0031] In the video encoding method according to the present invention, wherein the filter coefficient values include filter coefficients for geometric transformation of each block classification unit in the block classification unit of the coding unit.

[0032] In addition, a computer-readable recording medium according to the present invention can store a bitstream generated by the video encoding method according to the present invention.

[0033] Advantageous Effects

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

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

[0036] In addition, according to the present invention, a method and apparatus for performing in-loop filtering using multiple filter shapes to reduce the computational complexity, memory capacity requirement, and memory access bandwidth of a video encoder / decoder can be provided.

[0037] In addition, according to the present invention, a recording medium for storing a bitstream generated by a video encoding / decoding method or apparatus can be provided.

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

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

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

[0041] Figure 3 is a schematic diagram showing a picture partitioning structure for video encoding / decoding;

[0042] Figure 4 is a diagram showing an embodiment of intra prediction processing;

[0043] Figure 5 is a diagram showing an embodiment of inter prediction processing;

[0044] Figure 6 is a diagram for describing transform and quantization processing.

[0045] Figure 7 is a flowchart showing a video decoding method according to an embodiment of the present invention;

[0046] Figure 8 is a flowchart showing a video encoding method according to an embodiment of the present invention;

[0047] Figure 9 is a diagram showing an exemplary method for determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions;

[0048] Figures 10 to 12 is a diagram showing an exemplary subsampling-based method for determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions;

[0049] Figures 13 to 18 is a diagram showing an exemplary subsampling-based method for determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions;

[0050] Figures 19 to 30 is a diagram showing an exemplary method for determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions at a specific sample position according to an embodiment of the present invention;

[0051] Figure 31 is a diagram showing an exemplary method for determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions when a temporal layer identifier indicates the top layer;

[0052] Figure 32 is a diagram showing various computational techniques that can be used to replace a one-dimensional Laplacian operation according to an embodiment of the present invention;

[0053] Figure 33 is a diagram showing a diamond filter according to an embodiment of the present invention;

[0054] Figure 34 is a diagram showing a 5×5 tap filter according to an embodiment of the present invention;

[0055] Figure 35a and Figure 35b is a diagram showing various filter shapes according to an embodiment of the present invention;

[0056] Figure 36 is a diagram showing a horizontally and vertically symmetric filter according to an embodiment of the present invention;

[0057] Figure 37 is a diagram showing a filter generated by geometric transformation of a square filter, an octagonal filter, a snowflake filter, and a rhombic filter according to an embodiment of the present invention;

[0058] Figure 38 is a diagram showing a process of transforming a rhombic filter including 9×9 coefficients into a square filter including 5×5 coefficients; and

[0059] Figures 39 to 55d is a diagram showing an exemplary sub-sampling based method for determining gradient values in horizontal, vertical, first diagonal, and second diagonal directions. Detailed Description of the Invention

[0060] Various modifications can be made to the present invention, and there are various embodiments of the present invention. Herein, examples of the various embodiments will now be provided with reference to the accompanying drawings and will be described in detail. However, the present invention is not limited thereto, and although the exemplary embodiments may be interpreted to include all modifications, equivalent forms, or alternative forms within the technical concept and scope of the present invention. Similar reference numerals refer to functions that are the same or similar in all aspects. In the drawings, the shapes and sizes of the elements may be exaggerated for clarity. In the following detailed description of the present invention, reference is made to the accompanying drawings that illustrate specific embodiments in which the present invention can be implemented. These embodiments are described in sufficient detail to enable those skilled in the art to practice 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 connection with one embodiment can 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 each element within each disclosed embodiment can be modified without departing from the spirit and scope of the present disclosure. Therefore, the following detailed description should not be construed in a limiting sense, and the scope of the present disclosure is defined only by the appended claims (along with the full scope of equivalents claimed, where appropriate).

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

[0062] It will be understood that in this specification, when an element is referred to only as "connected to" or "coupled to" another element rather than "directly connected to" or "directly coupled to" another element, the element may be "directly connected to" or "directly coupled to" the other element, or may be connected to or coupled to the other element with other elements intervening therebetween. Conversely, it should be understood that when an element is referred to as "directly coupled" or "directly connected" to another element, there is no intervening element.

[0063] Furthermore, the constituent components shown in the embodiments of the present invention are shown independently so as to present different characteristic functions from each other. Therefore, this does not mean that each constituent component is constituted as a separate hardware or software constituent unit. In other words, for convenience, each constituent component includes each of the enumerated constituent components. Thus, at least two of the constituent components in each constituent component may be combined to form one constituent component, or one constituent component may be divided into multiple constituent components for performing each function. Embodiments in which each constituent component is combined and embodiments in which one constituent component is divided are also included in the scope of the present invention without departing from the essence of the present invention.

[0064] The terms used in this specification are only for describing specific embodiments and are not intended to limit the present invention. Expressions used in the singular include plural expressions unless it has a clearly different meaning in the context. In this specification, it will be understood that terms such as "including...", "having...", etc. are intended to indicate the presence of the features, quantities, steps, actions, elements, components, or combinations thereof disclosed in the specification, and are not intended to exclude the possibility of the existence or addition of one or more other features, quantities, steps, actions, elements, components, or combinations thereof. In other words, when a specific element is referred to as "being included", elements other than the corresponding element are not excluded, but rather additional elements may be included in the embodiments of the present invention or within the scope of the present invention.

[0065] In addition, some constituent elements may not be indispensable constituent elements for performing the essential functions of the present invention, but rather optional constituent elements that only enhance its performance. The present invention can be implemented by including only the essential indispensable constituent parts for implementing the present invention and excluding the constituent elements used for performance improvement. A structure that includes only the indispensable constituent elements and excludes the optional constituent elements used only for performance improvement is also included in the scope of the present invention.

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

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

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

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

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

[0071] 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, the target block may be a current block that is the target of current encoding and / or decoding. For example, the terms "target block" and "current block" may be used with the same meaning and may be replaced with each other.

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

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

[0074] 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 predicted block. A residual signal may be a signal representing a residual block.

[0075] In an embodiment, each of specific information, data, flag, index, element, and attribute, etc. may have a value. A value of information, data, flag, index, element, and attribute equal to "0" may represent logical false or a first predefined value. In other words, the values "0", false, logical false, and the first predefined value may be replaceable with each other. A value of information, data, flag, index, element, and attribute equal to "1" may represent logical true or a second predefined value. In other words, the values "1", true, logical true, and the second predefined value may be replaceable with each other.

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

[0077] Term description

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

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

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

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

[0082] Unit: It can refer to an encoding and decoding unit. When encoding and decoding an image, a unit can be a region generated by partitioning a single image. Additionally, when a single image is partitioned into sub-partition units during encoding or decoding, a unit can represent a sub-partition unit. That is, an image can be partitioned into multiple units. When encoding and decoding an image, predetermined processing can be performed for each unit. A single unit can be partitioned into sub-units with dimensions smaller than those of the unit. Depending on the function, a unit can represent a block, macroblock, coding tree unit, coding tree block, coding unit, coding block, prediction unit, prediction block, residual unit, residual block, transform unit, transform block, etc. Additionally, to distinguish a unit from a block, a unit can include a luminance component block, chrominance component blocks associated with the luminance component block, and syntax elements for each color component block. A unit can have various sizes and shapes. Specifically, the shape of a unit can be a two-dimensional geometric figure, such as a square, rectangle, trapezoid, triangle, pentagon, etc. Additionally, unit information can include at least one of the unit type indicating a coding unit, prediction unit, transform unit, etc., and the unit size, unit depth, and the order of encoding and decoding of the unit.

[0083] Coding tree unit: A single coding tree block configured with the luminance component Y and two coding tree blocks related to the chrominance components Cb and Cr. Additionally, a coding tree unit can represent including a block and the syntax elements for each block. Each coding tree unit can be partitioned by using at least one of a quadtree partitioning method, a binary tree partitioning method, and a ternary tree partitioning method to configure lower-level units such as coding units, prediction units, transform units, etc. A coding tree unit can 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, a quadtree can represent a quaternary tree.

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

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

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

[0087] Unit depth: May represent the degree of partitioning of a unit. In a tree structure, the highest node (root node) may correspond to a first unit that is not partitioned. Additionally, 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, a 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. Additionally, when a unit is represented as a tree structure, the level at which the unit exists may represent the unit depth.

[0088] Bitstream: May represent a bitstream including encoded image information.

[0089] Parameter set: Corresponding to the header information among the configurations within the bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptive parameter set may be included in the parameter set. Additionally, the parameter set may include slice header, parallel block group header, and parallel block header information. The term "parallel block group" represents a group of parallel blocks and has the same meaning as a slice.

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

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

[0092] Prediction mode: May be information indicating a mode encoded / decoded using intra prediction or a mode encoded / decoded using inter prediction.

[0093] Prediction unit: It can represent the basic unit when performing predictions such as inter-frame prediction, intra-frame prediction, inter-frame compensation, intra-frame compensation, and motion compensation. A single prediction unit can be partitioned into multiple partitions with smaller sizes, or can be partitioned into multiple lower-level prediction units. Multiple partitions can be the basic units when performing prediction or compensation. The partitions generated by dividing the prediction unit can also be prediction units.

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

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

[0096] The inter-frame prediction indicator can refer to the direction of inter-frame prediction (such as unidirectional prediction, bidirectional prediction, etc.) of the current block. Optionally, the inter-frame prediction indicator can refer to the number of reference pictures used to generate the prediction block of the current block. Optionally, the inter-frame prediction indicator can refer to the number of prediction blocks used when performing inter-frame prediction or motion compensation on the current block.

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

[0098] The reference picture index can refer to the index indicating a specific reference picture in the reference picture list.

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

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

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

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

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

[0104] The motion vector candidate index may represent an indicator that indicates a motion vector candidate in the motion vector candidate list. Optionally, the motion vector candidate index may be an index of a motion vector predictor.

[0105] Motion information may represent information including at least one of the following items: a motion vector, a reference picture index, an inter-frame 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.

[0106] The merge candidate list may represent a list composed of one or more merge candidates.

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

[0108] The merge index may represent an indicator that indicates a merge candidate in the merge candidate list. Optionally, the merge index may indicate a block among the reconstructed blocks adjacent to the current block spatially / temporally in which the merge candidate has been derived. Optionally, the merge index may indicate at least one motion information of the merge candidate.

[0109] A transform unit: may represent a basic unit when performing encoding / decoding on a residual signal (such as transform, inverse transform, quantization, dequantization, transform coefficient encoding / decoding). A single transform unit may be partitioned into multiple lower-level transform units with smaller sizes. Here, the transform / inverse transform may include at least one of a first transform / first inverse transform and a second transform / second inverse transform.

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

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

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

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

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

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

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

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

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

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

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

[0121] Statistical value: The statistical value for at least one of variables, coding parameters, constant values, etc. with computable specific values can be one or more of the average value, sum value, weighted average value, weighted sum value, minimum value, maximum value, most frequently occurring value, median value, interpolation value.

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

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

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

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

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

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

[0128] The motion compensation unit 112 may perform motion compensation on the current block by using the motion vector to generate a prediction block. Here, inter-frame prediction may represent prediction or motion compensation between frames.

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

[0130] The subtractor 125 may generate a residual block by using the residuals of 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 the residual signal of a block unit.

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

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

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

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

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

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

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

[0138] Here, it can be indicated that the encoder entropy-encodes the corresponding flag or index and includes it in the bitstream using a signaling flag or index, and it can be indicated that the decoder entropy-decodes the corresponding flag or index from the bitstream.

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

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

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

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

[0143] To compensate for coding errors, an appropriate offset value can be added to the sample value by using sample adaptive offset. The sample adaptive offset can correct the offset between the deblocked image and the original image on a sample-by-sample basis. A method that applies the offset considering the edge information about each sample can be used, 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.

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

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

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

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

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

[0149] 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 through a wired / wireless transmission medium. The decoding device 200 may decode the bitstream by using an intra mode or an inter mode. In addition, the decoding device 200 may generate a reconstructed image or a decoded image generated by decoding, and output the reconstructed image or the decoded image.

[0150] When the prediction mode used during decoding is the intra mode, the switcher may be switched to intra. Optionally, when the prediction mode used during decoding is the inter mode, the switcher may be switched to the inter mode.

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

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

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

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

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

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

[0157] The adder 225 may generate a reconstructed block by adding the reconstructed residual block and the prediction block. The filter unit 260 may apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive loop filter to the reconstructed block or the reconstructed image. The filter unit 260 may output the reconstructed image. The reconstructed block or the reconstructed image may be stored in the reference picture buffer 270 and used during inter prediction. The reconstructed block processed by the filter unit 260 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 260. The stored reference image may be used later during inter prediction or motion compensation.

[0158] Figure 3 is a diagram schematically showing a partitioning structure of an image when the image is encoded and decoded. Figure 3 schematically shows an example of partitioning a single unit into a plurality of lower-level units.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0175] The partition indication information, the partition tree information, and the partition direction information can all be flags having a predetermined length (e.g., one bit).

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

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

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

[0179] However, when the size of a coding unit (i.e., the basic unit for partitioning) is larger than the size of the maximum transform block, the coding unit can be recursively partitioned until the size of the coding unit is reduced to be equal to or less than the size of the maximum transform block. For example, when the size of the coding unit is 64×64 and when the size of the maximum transform block is 32×32, the coding unit can be partitioned into four 32×32 blocks for transformation. For example, when the size of the coding unit is 32×64 and the size of the maximum transform block is 32×32, the coding unit can be partitioned into two 32×32 blocks for transformation. In this case, the partitioning of the coding unit for transformation is not signaled separately, and the partitioning of the coding unit for transformation can be determined by comparing the horizontal size or vertical size of the coding unit with the horizontal size or vertical size of the maximum transform block. For example, when the horizontal size (width) of the coding unit is larger than the horizontal size (width) of the maximum transform block, the coding unit can be bisected vertically. For example, when the vertical size (length) of the coding unit is larger than the vertical size (length) of the maximum transform block, the coding unit can be bisected horizontally.

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

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

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

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

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

[0185] For example, when the size of the coding unit is not greater than the minimum size of the quadtree, the coding unit does not contain quad-partition information. Therefore, the quad-partition information can be derived from a second value.

[0186] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to a node of the multi-type tree is greater than the maximum size (horizontal size and vertical size) of the binary tree and / or the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit may not be bipartitioned or tripartitioned. Therefore, instead of signaling the multi-type tree partition indication information, the multi-type tree partition indication information can be derived from a second value.

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

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

[0189] Optionally, the multi-type tree partition indication information may be signaled only when at least one of a vertical binary tree partition, a horizontal binary tree partition, a vertical ternary tree partition, and a horizontal ternary tree partition is feasible for a coding unit corresponding to a node of a multi-type tree. Otherwise, it may not be possible to bipartition and / or tripartition the coding unit. Therefore, instead of signaling the multi-type tree partition indication information, the multi-type tree partition indication information may be derived from a second value.

[0190] Optionally, the partition direction information may be signaled only when both a vertical binary tree partition and a horizontal binary tree partition, or both a vertical ternary tree partition and a horizontal ternary tree partition, are feasible for a coding unit corresponding to a node of a multi-type tree. Otherwise, instead of signaling the partition direction information, the partition direction information may be derived from a value indicating possible partition directions.

[0191] Optionally, the partition tree information may be signaled only when both a vertical binary tree partition and a vertical ternary tree partition, or both a horizontal binary tree partition and a horizontal ternary tree partition, are feasible for a coding tree corresponding to a node of a multi-type tree. Otherwise, instead of signaling the partition tree information, the partition tree information may be derived from a value indicating possible partition tree structures.

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

[0193] Figure 4 The arrows from the center to the outside in may represent the prediction directions of the intra prediction modes.

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

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

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

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

[0198] The intra prediction mode can be a non - angular mode or an angular mode. The non - angular mode can be a DC mode or a planar mode, and the angular mode can be a prediction mode with a specific direction or angle. The intra prediction mode can be represented by at least one of a mode number, a mode value, a mode digit, a mode angle, and a mode direction. The number of intra prediction modes can be M which is greater than or equal to 1, including the non - angular mode and the angular mode.

[0199] To perform intra prediction on the current block, a step of determining whether samples included in the reconstructed neighboring blocks can be used as reference samples for the current block can be performed. When there are samples that cannot be used as reference samples for the current block, the value obtained by copying or performing interpolation or both copying and interpolation on at least one sample value among the samples included in the reconstructed neighboring blocks can be used to replace the unavailable sample values of the samples, so that the replaced sample values are used as reference samples for the current block.

[0200] When performing intra prediction, 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 size of a current block.

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

[0202] An intra prediction mode of a current block may be entropy-coded / entropy-decoded by predicting an intra prediction mode of a block adjacent to the current block. When the intra prediction mode of the current block is the same as that of an adjacent block, information that the intra prediction modes of the current block and the adjacent block are the same may be signaled by using predetermined flag information. In addition, indicator information of an intra prediction mode that is the same as the intra prediction mode of the current block among intra prediction modes of a plurality of adjacent blocks may be signaled. When the intra prediction mode of the current block is different from that of an adjacent block, the intra prediction mode information of the current block may be entropy-coded / entropy-decoded by performing entropy coding / entropy decoding based on the intra prediction mode of the adjacent block.

[0203] Figure 5 is a diagram illustrating an embodiment of an inter prediction process.

[0204] In Figure 5 a rectangle may represent a picture. In Figure 5 an arrow represents a prediction direction. According to an encoding type of a picture, a picture may be classified into an intra picture (I picture), a predicted picture (P picture), and a bi-predicted picture (B picture).

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

[0206] Hereinafter, embodiments of inter prediction will be described in detail.

[0207] Inter-picture prediction or motion compensation can be performed using a reference picture and motion information.

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

[0209] The method of deriving the motion information of the current block can vary according to the prediction mode of the current block. For example, as prediction modes for inter-picture prediction, there can be an AMVP mode, a merge mode, a skip mode, a current picture reference mode, etc. The merge mode can be referred to as a motion merge mode.

[0210] For example, when AMVP is used as the prediction mode, at least one of the motion vectors 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 can be determined as a motion vector candidate for the current block, and a motion vector candidate list can be generated by using the motion vector candidates. The motion vector candidate of the current block can be derived by using the generated motion vector candidate list. The motion information of the current block can be determined based on the derived motion vector candidate. The motion vector of the co-located block or the motion vector of the block adjacent to the co-located block can be referred to as a temporal motion vector candidate, and the motion vector of the reconstructed neighboring block can be referred to as a spatial motion vector candidate.

[0211] The encoding device 100 can calculate the motion vector difference (MVD) between the motion vector of the current block and the motion vector candidate, and can perform entropy coding on the motion vector difference (MVD). In addition, the encoding device 100 can perform entropy coding on the motion vector candidate index and generate a bitstream. The motion vector candidate index can indicate the best motion vector candidate among the motion vector candidates included in the motion vector candidate list. The decoding device can perform entropy decoding on the motion vector candidate index included in the bitstream, and can select the motion vector candidate of 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 can add the entropy-decoded MVD to the motion vector candidate extracted by entropy decoding, thereby deriving the motion vector of the decoding target block.

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

[0213] Another example of a method for deriving motion information of a current block may be the merge mode. The merge mode may represent a method of merging the motions of multiple blocks. The merge mode may represent a mode of deriving the motion information of the current block from the motion information of neighboring blocks. When the merge mode is applied, the motion information of the reconstructed neighboring blocks and / or the motion information of the 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 uni-directional prediction (L0 prediction or L1 prediction) or bi-directional prediction (L0 prediction and L1 prediction).

[0214] 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 a zero merge candidate and new motion information, where the new motion information is a combination of the motion information of a neighboring block adjacent to the current block (spatial merge candidate), the motion information of the co-located block of the current block included in the reference picture (temporal merge candidate), and the motion information existing in the merge candidate list.

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

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

[0217] The current picture reference mode may represent a prediction mode in which a previously reconstructed region within the current picture to which the current block belongs is used for prediction. Here, a vector may be used to specify the previously reconstructed region. Information indicating whether the current block is to be coded in the current picture reference mode may be coded by using a reference picture index of the current block. A flag or index indicating whether the current block is a block coded in the current picture reference mode may be signaled, and the flag or index may be derived based on the reference picture index of the current block. In the case where the current block is coded in the current picture reference mode, the current picture may be added to the reference picture list for the current block so that the current picture is located at a fixed position or an arbitrary position in the reference picture list. The fixed position may be, for example, the position indicated by the reference picture index 0, or the last position in the list. When the current picture is added to the reference picture list so that the current picture is located at an arbitrary position, a reference picture index indicating the arbitrary position may be signaled.

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

[0219] As Figure 6 shown, a transform process and / or a quantization process is performed on the residual signal to generate a quantized level signal. The residual signal is the difference between the original block and the predicted block (i.e., an intra-predicted block or an inter-predicted block). The predicted block is a block generated by intra-prediction or inter-prediction. The transform may be a first transform, a second transform, or both a first transform and a second transform. The first transform on the residual signal generates transform coefficients, and the second transform on the transform coefficients generates second transform coefficients.

[0220] At least one scheme selected from various predefined transform schemes is used to perform the first transform. For example, examples of the predefined transform schemes include a discrete cosine transform (DCT), a discrete sine transform (DST), and a Karhunen-Loève transform (KLT). The transform coefficients generated by the first transform may be subjected to a second transform. The transform scheme for the first transform and / or the second transform may be determined according to coding parameters of the current block and / or neighboring blocks of the current block. Alternatively, the transform scheme may be determined by signaling of transform information.

[0221] Since the residual signal is quantized through the first transformation and the second transformation, a quantized level signal (quantization coefficient) is generated. Depending on the intra prediction mode or block size / shape of the block, the quantized level signal can be scanned according to at least one of a top-right diagonal scan, a vertical scan, and a horizontal scan. For example, when scanning the coefficients according to a top-right diagonal scan, the coefficients in block form become a one-dimensional vector form. In addition to the top-right diagonal scan, a horizontal scan that horizontally scans the coefficients in two-dimensional block form or a vertical scan that vertically scans the coefficients in two-dimensional block form can be used depending on the intra prediction mode and / or size of the transform block. The scanned quantized level coefficients can be entropy encoded to be inserted into the bitstream.

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

[0223] Then, the quantized level coefficients can be dequantized, then a second inverse transformation can be performed as needed, and finally a first inverse transformation can be performed as needed to generate a reconstructed residual signal.

[0224] Hereinafter, reference will be made to Figures 7 to 5 5 to describe an in-loop filtering method using subsampling-based block classification according to an embodiment of the present invention.

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

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

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

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

[0229] Unless otherwise specifically stated in the description of the present invention, in-loop filtering refers to adaptive in-loop filtering.

[0230] In the present invention, filtering represents a process of applying a filter to at least one basic unit selected from samples, blocks, coding units (CUs), prediction units (PUs), transform units (TUs), coding tree units (CTUs), stripes, parallel blocks, groups of parallel blocks (parallel block groups), pictures, and sequences. Filtering includes at least one of block classification processing, filtering execution processing, and filter information encoding / decoding processing.

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

[0232] 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 that is used as a basic unit during encoding / decoding processing.

[0233] Performing in-loop filtering causes bidirectional filtering, deblocking filtering, sample adaptive offset, and adaptive in-loop filtering to be sequentially applied to the reconstructed picture to generate a decoded picture. However, the order in which the filtering schemes classified as in-loop filtering are applied to the reconstructed picture varies.

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

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

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

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

[0238] In the present invention, the decoded picture refers to the output from in-loop filtering or post-processing filtering performed on the reconstructed picture composed of reconstructed blocks, where each reconstructed block is generated by summing the reconstructed residual block and the corresponding intra-predicted block or summing the reconstructed block and the corresponding inter-predicted block. In the present invention, the meanings of decoded sample, decoded block, decoded CTU, or decoded picture are the same as the meanings of reconstructed sample, reconstructed block, reconstructed CTU, or reconstructed picture, respectively.

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

[0240] In-loop filtering can be performed on a decoded picture that has already undergone at least one in-loop filtering method among in-loop filtering methods. For example, when performing at least one in-loop filtering method among at least one in-loop filtering method on a decoded picture that has already undergone at least one in-loop filtering method among other in-loop filtering methods, the parameters for the latter filtering method can be changed, and then the previous filtering can be performed on the decoded picture using the changed parameters. In this case, the parameters include coding parameters, filter coefficients, the number of filter taps (filter length), filter shape, filter type, the number of times filtering is performed, filter strength, threshold, and / or combinations of these parameters.

[0241] The filter coefficients represent the coefficients that make up the filter. Optionally, the filter coefficients represent the coefficient values corresponding to specific mask positions in the form of a mask, and the reconstructed samples are multiplied by these coefficient values.

[0242] The number of filter taps refers to the length of the filter. When the filter is symmetric with respect to a specific direction, the filter coefficients to be encoded / decoded can be reduced by half. Additionally, a filter tap refers to the width (horizontal dimension) or height (vertical dimension) of the filter. Optionally, a filter tap refers to both the width (lateral dimension) and height (longitudinal dimension) of a two-dimensional filter. Additionally, the filter can be symmetric with respect to two or more specific directions.

[0243] When the filter has a mask form, the filter can be a two-dimensional geometric figure having the following shapes: square / rhombus shape, non-square rectangular shape, square shape, trapezoidal shape, diagonal shape, snowflake shape, hash shape, four-leaf clover shape, cross shape, triangular shape, pentagonal shape, hexagonal shape, octagonal shape, decagonal shape, dodecagonal shape, or any combination of these shapes. Optionally, the filter shape can be a shape obtained by projecting a three-dimensional figure onto a two-dimensional plane.

[0244] The filter type represents a filter selected from a Wiener filter, a low-pass filter, a high-pass filter, a linear filter, a non-linear filter, and a bi-directional filter.

[0245] In the present invention, among various filters, the Wiener filter will be described in detail. However, the present invention is not limited thereto, and a combination of the above filters can be used in embodiments of the present invention.

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

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

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

[0249] In addition, at least one of the filtering methods may be performed as post-processing filtering after decoding processing. For example, a Wiener filter may be used as a post-processing filter after decoding processing. When a Wiener filter is used after decoding processing, the Wiener filter is applied to the reconstructed / decoded picture before output (i.e., display) of 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 subsequent pictures to be encoded / decoded.

[0250] Adaptive in-loop filtering cannot be performed on a per-block basis. That is, block-based filter adaptation cannot be performed. Here, block-based filter adaptation means separately selecting different filters for different blocks. Block-based filter adaptation also means block classification.

[0251] Figure 7 is a flowchart showing a video decoding method according to an embodiment of the present invention.

[0252] Referring to Figure 7 , the decoder decodes filter information for each coding unit (S701).

[0253] The filter information is not limited to filter information based on each coding unit. The filter information also represents filter information based on each strip, parallel block, parallel block group, picture, sequence, CTU, block, CU, PU, or TU.

[0254] The filter information includes information on 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 on whether a fixed filter is used for block classification index, and / or filter symmetry type information.

[0255] The filter shape information includes at least one shape selected from a rhombus (square shape), rectangle, square, trapezoid, diagonal shape, snowflake shape, number sign shape, four-leaf clover shape, cross shape, triangle, pentagon, hexagon, octagon, decagon, and dodecagon.

[0256] The filter coefficient values include filter coefficient values for geometric transformation of each block, where samples are classified into classes based on each block classification unit.

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

[0258] In addition, the decoder performs block classification on the samples of the coding unit based on each block classification unit (step S702). Furthermore, the decoder assigns a block classification index to the block classification unit in the coding unit.

[0259] The block classification is not limited to classification based on each coding unit. That is, the block classification can be performed in units of strips, parallel blocks, parallel block groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0260] The block classification index is determined based on the directionality information and the activity information.

[0261] At least one of the directionality information and the activity information is determined according to the gradient value with respect to at least one of the vertical, horizontal, first diagonal, and second diagonal directions.

[0262] On the other hand, a one-dimensional Laplacian operation is used to obtain the gradient value based on each block classification unit.

[0263] The one-dimensional Laplacian operation is preferably a one-dimensional Laplacian operation where the operation position is the subsampled position.

[0264] Optionally, the gradient value can be determined according to the time layer identifier.

[0265] In addition, the decoder filters the coding unit that has been block classified based on each block classification unit by using the filter information (S703).

[0266] The filtering target unit is not limited to the coding unit. That is, the filtering can be performed in units of strips, parallel blocks, parallel block groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0267] Figure 8 is a flowchart showing a video coding method according to an embodiment of the present invention;

[0268] Refer to Figure 8, the encoder classifies the samples in the coding unit into classes based on each block classification unit (step S801). In addition, the encoder assigns a block classification index to the block classification units in each coding unit.

[0269] The basic unit for block classification is not limited to the coding unit. That is, block classification can be performed in units of strip, parallel block, parallel block group, picture, sequence, CTU, block, CU, PU, or TU.

[0270] The block classification index is determined based on the directionality information and the activity information.

[0271] At least one of the directionality information and the activity information is determined based on the gradient value with respect to at least one of the vertical, horizontal, first diagonal, and second diagonal directions.

[0272] The gradient value is obtained using a one-dimensional Laplacian operation based on each block classification unit.

[0273] The one-dimensional Laplacian operation is preferably a one-dimensional Laplacian operation where the operation position is the subsampled position.

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

[0275] In addition, the encoder filters the coding unit samples classified based on each block classification unit by using the filter information of the coding unit (S802).

[0276] The basic unit for filtering is not limited to the coding unit. That is, filtering can be performed in units of strip, parallel block, parallel block group, picture, sequence, CTU, block, CU, PU, or TU.

[0277] The filter information includes information on whether to perform filtering, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information on whether to use a fixed filter for the block classification index, and / or filter symmetry type information.

[0278] Examples of filter shapes include at least one of diamond (square), rectangle, square, trapezoid, diagonal, snowflake, hash, four-leaf clover, cross, triangle, pentagon, hexagon, octagon, decagon, and dodecagon.

[0279] The filter coefficient values include filter coefficient values obtained by geometric transformation based on each block classification unit.

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

[0281] The filter information is not limited to the filter information based on each coding unit. The filter information may be the filter information based on each slice, parallel block, parallel block group, picture, sequence, CTU, block, CU, PU, or TU.

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

[0283] More specifically, at the encoder side, the adaptive in-loop filtering can be divided into several sub-steps, such as block classification, filter coefficient derivation, filtering execution determination, filter shape determination, filtering execution, and filter information coding. The filter coefficient derivation, filtering execution determination, and filter shape determination do not fall within the scope of the present invention. Therefore, these sub-steps are not described in depth, but only briefly described. Thus, at the encoder side, the in-loop filtering process is divided into block classification, filtering, filter information coding, etc.

[0284] In the filter coefficient derivation step, the Wiener filter coefficients that can minimize the distortion between the original picture and the filtered picture are derived. In this case, the Wiener filter coefficients are derived based on each block classification. Additionally, the Wiener filter coefficients are derived according to 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 samples, the cross-correlation function for the original samples and the reconstructed samples, 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 Wiener-Hopf equation is calculated based on Gaussian elimination or Cholesky decomposition to obtain the filter coefficients.

[0285] In the filtering execution determination step, according to rate-distortion optimization, it is determined whether to perform adaptive in-loop filtering based on each slice, picture, parallel block, or parallel block group, whether to perform adaptive in-loop filtering based on each block, or whether not to perform adaptive in-loop filtering. Here, the rate includes the filter information to be encoded. The distortion is the difference between the original picture and the reconstructed picture or the difference between the original picture and the filtered reconstructed picture. The distortion is represented by the mean squared error (MSE), the sum of mean squared errors (SSE), the sum of absolute differences, etc. In the filtering execution determination step, it is determined whether to perform filtering on the chrominance component and whether to perform filtering on the luminance component.

[0286] In the filter shape determination step, when applying in-loop adaptive filtering, it can be determined according to rate-distortion optimization what filter shape to use, what number of tap filters to use, etc.

[0287] Additionally, at the decoder side, the adaptive in-loop filtering process is divided into filter information decoding, block classification, and filtering steps.

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

[0289] Hereinafter, the block classification step will be first described.

[0290] In the reconstructed picture, block classification indexes are assigned based on blocks of size M×N (or based on each block classification unit) such that the blocks in the reconstructed picture can be classified into L classes. Here, the block classification indexes can be assigned not only to the reconstructed / decoded picture, but also to at least one of the recovered / decoded strip, the recovered / decoded parallel block group, the recovered / decoded parallel block, the recovered / decoded CTU, and the recovered / decoded block.

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

[0292] For example, a total of 25 block classification indexes can be assigned to the reconstructed picture based on each 2×2-sized block. For example, a total of 25 block classification indexes can be assigned to the reconstructed picture based on each 4×4-sized block.

[0293] The block classification index is a value in the range from 0 to L−1, or can be a value in the range from 1 to L.

[0294] The block classification index C is determined based on at least one of the directional value D and the quantization activity value A of the activity value A q and is represented by Equation 1.

[0295] [Equation 1]

[0296] C = 5D + A q

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

[0298] For example, in one embodiment where block classification is performed based on each 2×2-sized block, the sum of the one-dimensional Laplacian gradient values in the vertical direction is represented by g v and the sums of the one-dimensional Laplacian gradient values in the horizontal direction, the first diagonal direction (angle 135°), and the second diagonal direction (angle 45°) are represented by g h , g d1 and gd2 Indications. The Laplacian operations in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction are represented by Expression 2, Expression 3, Expression 4, and Expression 5 respectively. The directional 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. Optionally, any statistical value of the gradient values can be used instead of the sum of the gradient values.

[0299] [Equation 2]

[0300]

[0301] [Equation 3]

[0302]

[0303] [Equation 4]

[0304]

[0305] D1 k,l = |2R(k, l) - R(k - 1, l - 1) - R(k + 1, l + 1)|

[0306] [Equation 5]

[0307]

[0308] D2 k,l = |2R(k, l) - R(k - 1, l + 1) - R(l + 1, l - 1)|

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

[0310] In Equations 2 to 5, k and l respectively represent the horizontal operation range and the vertical operation range for generating the sum of the results V k,l 、H k,l 、D1 k,l 、D2 k,l of the one - dimensional Laplacian operations based on samples for each direction. The result of the one - dimensional Laplacian operation based on samples for a direction represents the gradient value based on samples for the corresponding direction. That is, the result of the one - dimensional Laplacian operation represents the gradient value. The one - dimensional Laplacian operation is performed in each of the vertical, horizontal, first diagonal, and second diagonal directions, and the one - dimensional Laplacian operation indicates the gradient value for the corresponding direction. Additionally, the results of the one - dimensional Laplacian operations for the vertical, horizontal, first diagonal, and second diagonal directions are respectively represented by V k,l 、H k,l 、D1k,l and D2 k,l are used to represent.

[0311] For example, k and l can be the same range. That is, the horizontal length and the vertical length of the operation range for calculating the one-dimensional Laplacian sum can be the same.

[0312] Optionally, k and l can be different ranges. That is, the horizontal length and the vertical length of the operation range for calculating the one-dimensional Laplacian sum can be different.

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

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

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

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

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

[0318] For example, the range for calculating the sum of the one-dimensional Laplacian operation is S×T in size. In this case, both S and T are zero or positive integers.

[0319] In addition, D1 representing the first diagonal and D2 representing the second diagonal can respectively refer to D0 representing the first diagonal and D1 representing the second diagonal.

[0320] For example, in one embodiment where block classification is performed on each 4×4 sized block, the sum g of gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction is calculated based on a one-dimensional Laplacian operation through Equation 6, Equation 7, Equation 8, and Equation 9 v 、g h 、g d1 、g d2 . The directional 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. Optionally, any statistical value of the gradient values can be used instead of the sum of the gradient values.

[0321] [Equation 6]

[0322]

[0323] [Equation 7]

[0324]

[0325] [Equation 8]

[0326]

[0327] D1 k,l = |2R(k,l) - R(k-1,l-1) - R(k+1,l+1)|

[0328] [Equation 9]

[0329]

[0330] D2 k,l = |2R(k,l) - R(k-1,l+1) - R(k+1,l-1)|

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

[0332] In Equations 6 to 9, k and l respectively represent the results V k,l 、H k,l 、D1 k,l 、D2 k,lThe horizontal operation range and the vertical operation range of the sum. The result of the one-dimensional Laplacian operation based on samples in one direction represents the gradient value based on samples in the corresponding direction. That is, the result of the one-dimensional Laplacian operation represents the gradient value. The one-dimensional Laplacian operation is performed for each of the vertical, horizontal, first diagonal, and second diagonal directions, and the one-dimensional Laplacian operation indicates the gradient value in the corresponding direction. In addition, the results of the one-dimensional Laplacian operations in the vertical, horizontal, first diagonal, and second diagonal directions are respectively represented as V kl 、H kl 、D1 kl 、D2 kl 。

[0333] For example, k and l can be the same range. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplacian operations can be the same.

[0334] Optionally, k and l can be different ranges. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplacian operations can be different.

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

[0336] As another example, k is in the range from i to i + 3, and l is in the range from j to j + 3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is 4×4 in size. 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.

[0337] For example, the operation range for calculating the sum of the results of the one-dimensional Laplacian 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 four-leaf clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

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

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

[0340] Figure 9It is a diagram showing an exemplary method for separately determining gradient values for horizontal, vertical, first diagonal, and second diagonal directions.

[0341] As Figure 9 shown, when performing block classification based on each 4×4-sized block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated v 、g h 、g d1 、g d2 for at least one of them. Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are respectively performed for the vertical, horizontal, first diagonal, and second diagonal directions at positions V, H, D1, and D2. In Figure 9 , the block classification index C is assigned to the shaded 4×4-sized block. 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-line rectangle represents the reconstructed sample position, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0342] For example, in one embodiment of performing block classification based on each 4×4-sized block, the one-dimensional Laplacian sums g of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction are respectively calculated by Equations 10 to 13 v 、g h 、g d1 、g d2 . The gradient values are represented based on sub-samples to reduce the computational complexity of block classification. The directional 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. Optionally, any statistical value of the gradient values can be used instead of the sum of the gradient values.

[0343] [Equation 10]

[0344] g v =∑ k ∑ l V k,l ,V k,l =|2R(k,l)-R(k,l - 1)-R(k,l + 1)|,

[0345] k=i - 2,i,i + 2,i + 4,l=j - 2,…,j + 5

[0346] [Equation 11]

[0347] g h =∑ k ∑ l Hk,l , H k,l = |2R(k, l) - R(k - 1, l) - R(k + 1, l)|,

[0348] k = i - 2, …, i + 5, l = j - 2, j, j + 2, j + 4

[0349] [Equation 12]

[0350] g d1 = ∑ k ∑ l m k,l D1 k,l ,

[0351] D1 k,l = |2R(k, l) - R(k - 1, l - 1) - R(k + 1, l + 1)|,

[0352] k = i - 2, …, i + 5, l = j - 2, …, j + 5

[0353]

[0354] [Equation 13]

[0355] g d2 = ∑ k ∑ l n k,l D2 k,l ,

[0356] D2 k,l = |2R(k, l) - R(k - 1, l + 1) - R(k + 1, l - 1)|,

[0357] k = i - 2, …, i + 5, l = j - 2, …, j + 5

[0358]

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

[0360] In Equations 10 to 13, k and l respectively represent the results V of calculating the one-dimensional Laplacian operation based on the samples k,l , H k,l , D1 k,l , D2 k,lThe horizontal operation range and the vertical operation range of the sum. The result of the one-dimensional Laplacian operation based on samples in one direction represents the gradient value based on samples in the corresponding direction. That is, the result of the one-dimensional Laplacian operation represents the gradient value. The one-dimensional Laplacian operation is performed for each of the vertical, horizontal, first diagonal, and second diagonal directions, and the one-dimensional Laplacian operation indicates the gradient value in the corresponding direction. Additionally, the results of the one-dimensional Laplacian operations for the vertical, horizontal, first diagonal, and second diagonal directions are respectively represented as V k,l 、H k,l 、D1 k,l 、D2 k,l 。

[0361] For example, k and l can be the same range. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplacian operations are the same.

[0362] Optionally, k and l can be different ranges. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplacian operations can be different.

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

[0364] As another example, k is a range from i to i + 3, and l is a range from j to j + 3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is 4×4 in size. 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

[0378] On the other hand, the gradient refers to at least one of the gradient with respect to the horizontal direction, the gradient with respect to the vertical direction, the gradient with respect to the first diagonal direction, and the gradient with respect to the second diagonal direction.

[0379] Figures 10 to 12 is a diagram showing a subsampling-based method for determining gradient values for the horizontal, vertical, first diagonal, and second diagonal directions.

[0380] As Figure 10 shown, when performing block classification based on each 2×2 stored block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated based on subsampling v 、g h 、g d1 、g d2 of at least one of them. Here, V, H, D1, and D2 respectively represent the results of the one-dimensional Laplacian operations based on samples for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are respectively performed at positions V, H, D1, and D2 for the vertical, horizontal, first diagonal, and second diagonal directions. Additionally, the positions where the one-dimensional Laplacian operations are performed are the subsampling positions. In Figure 10In [the figure], the block classification index C is assigned to the shaded 2×2-sized block. 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-line rectangle indicates the reconstructed sample position, and the thick solid-line rectangle indicates the operation range for calculating the one-dimensional Laplacian sum.

[0381] In the drawings of the present invention, the positions not indicated by V, H, D1, or D2 are the sample positions where the one-dimensional Laplacian operation is not performed in a direction. That is, the one-dimensional Laplacian operation is performed in each direction only at the sample positions indicated by V, H, D1, or D2. When the one-dimensional Laplacian operation is not performed, the result of the one-dimensional Laplacian operation at the corresponding sample position is determined as a specific value, for example, H. Here, H can be at least one of a negative integer, 0, and a positive integer.

[0382] As Figure 11 shown in [the figure], when performing block classification based on a 4×4-sized block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated based on subsampling v 、g h 、g d1 、g d2 for at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are performed along the vertical, horizontal, first diagonal, and second diagonal directions at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operation is performed are the subsampled positions. In Figure 11 [the figure], the block classification index C is assigned to the shaded 4×4-sized block. 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-line rectangle indicates the reconstructed sample position, and the thick solid-line rectangle indicates the operation range for calculating the one-dimensional Laplacian sum.

[0383] As Figure 12 shown in [the figure], when performing block classification based on a 4×4-sized block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated based on subsampling v 、g h 、g d1 、g d2 for at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are performed along the vertical, horizontal, first diagonal, and second diagonal directions at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operation is performed are the subsampled positions. InFigure 12 In this case, the block classification index C is assigned to the shaded 4×4-sized block. In this case, the operation range for calculating the sum of one-dimensional Laplacian operations is equal to the size of the block classification unit. Here, the thin solid line rectangle indicates the position of the reconstructed sample points, and the thick solid line rectangle indicates the operation range for calculating the one-dimensional Laplacian sum.

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

[0385] For example, the absolute position represents the upper left position within the N×M block.

[0386] Optionally, the absolute position represents the lower right position within the N×M block.

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

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

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

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

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

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

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

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

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

[0396] Figures 13 to 18 is a diagram showing an exemplary method based on sub-sampling for determining gradient values along the horizontal, vertical, first diagonal, and second diagonal directions.

[0397] As Figure 13 shown, when performing block classification based on each block of 4×4 size, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions is calculated by using the sample points at specific positions within each block of N×M size based on sub-sampling v 、g h 、g d1 、g d2 of at least one of them. Here, V, H, D1, and D2 respectively represent the results of the one-dimensional Laplacian operations based on sample points for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. In addition, the positions where the one-dimensional Laplacian operations are performed can be the sub-sampling positions. In Figure 13 , the block classification index C is assigned to the shaded 4×4 size block. 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 line rectangle represents the reconstructed sample point positions, and the thick solid line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0398] As Figure 14As shown in [figure reference], when performing block classification based on each 4×4-sized block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated by using the samples at specific positions within each N×M-sized block based on subsampling. v g h g d1 g d2 of at least one of them. Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples for the vertical, horizontal, first diagonal, and second diagonal directions. That is, one-dimensional Laplacian operations are performed along the vertical, horizontal, first diagonal, and second diagonal directions at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed are the subsampled positions. In Figure 14 , the block classification index C is assigned to the shaded 4×4-sized block. 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0399] As Figure 15 shown in [figure reference], when performing block classification based on each 4×4-sized block, the sum g of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated by using the samples at specific positions within each N×M-sized block based on subsampling. v g h g d1 g d2 of at least one of them. Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples for the vertical, horizontal, first diagonal, and second diagonal directions. That is, one-dimensional Laplacian operations are performed along the vertical, horizontal, first diagonal, and second diagonal directions at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed can be the subsampled positions. In Figure 15 , the block classification index C is assigned to the shaded 4×4-sized block. 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian.

[0400] As Figure 16 shown in [figure reference], when performing block classification based on each 4×4-sized block, the sum of the gradient values for the vertical, horizontal, first diagonal, and second diagonal directions, g v gh , g d1 , g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed are subsampled positions. In Figure 16 , the block classification index C is assigned to the shaded 4×4-sized block. 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0401] As Figure 17 shown, when performing block classification based on 4×4-sized blocks, the sum of the gradient values g for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated by using samples at specific positions within each N×M-sized block based on subsampling v , g h , g d1 , g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed can be subsampled positions. In Figure 17 , the block classification index C is assigned to the shaded 4×4-sized 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 size of the operation range for calculating the sum of the one-dimensional Laplacian operations is 1×1, the gradient values can be calculated without calculating the sum of the one-dimensional Laplacian operations. Here, the thin solid-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0402] As Figure 18 shown, when performing block classification based on 2×2-sized blocks, the sum of the gradient values g for the vertical, horizontal, first diagonal, and second diagonal directions can be calculated by using samples at specific positions within each N×M-sized block based on subsampling v , g h , g d1 , g d2at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions where the one-dimensional Laplacian operations are performed can be subsampled positions. In Figure 18 a block classification index C is assigned to the shaded 2×2-sized 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 size of the operation range for calculating the sum of the one-dimensional Laplacian operations is 1×1, the gradient value can be calculated without calculating the sum of the one-dimensional Laplacian operations. Here, the thin solid-line rectangle represents the reconstructed sample position, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0403] Figures 19 to 30 is a diagram showing a method for determining the gradient values with respect to the horizontal, vertical, first diagonal, and second diagonal directions at a specific sample position. The specific sample position can be a subsampled sample position within the block classification unit, or can be a subsampled sample position within the operation range for calculating the sum of the one-dimensional Laplacian operations. Additionally, the specific sample position is a sample position within each block. Optionally, the specific sample position can vary from block to block. Furthermore, regardless of the direction of the one-dimensional Laplacian operation to be calculated, the specific sample position can be the same. Additionally, regardless of the direction of the one-dimensional Laplacian operation, the specific sample position can be the same for each block.

[0404] As Figure 19 shown in, when performing block classification based on 4×4-sized blocks, the sum g of the gradient values is calculated at one or more specific sample positions v 、g h 、g d1 、g d2 at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions where the one-dimensional Laplacian operations are performed can be subsampled positions. In Figure 19 a block classification index C is assigned to the shaded 4×4-sized block. In this case, the operation range for calculating the Laplacian sum can be larger than the size of the block classification unit. Here, the thin solid-line rectangle represents the reconstructed sample position, and the thick solid-line rectangle represents the operation range for calculating the Laplacian sum.

[0405] As shown in Figure 19 , regardless of the direction of the one-dimensional Laplacian operation, the specific sample positions for performing the one-dimensional Laplacian operation are the same. Additionally, as shown in Figure 19 , the pattern of the sample positions for performing the one-dimensional Laplacian calculation can be referred to as a checkerboard pattern or a plum blossom pattern. Additionally, all the sample positions for performing the one-dimensional Laplacian operation are even or odd sample positions in both the horizontal direction (X-axis direction) and the vertical direction (Y-axis direction) within the operation range for calculating the one-dimensional Laplacian sum within a block classification unit or a block unit.

[0406] As shown in Figure 20 , when performing block classification based on a 4×4-sized block, the sum g of the gradient values is calculated at one or more specific sample positions v 、g h 、g d1 、g d2 . Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations performed for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions for performing the one-dimensional Laplacian operation can be subsampled positions. In Figure 20 , a block classification index C is assigned to the shaded 4×4-sized block. In this case, the operation range of the one-dimensional Laplacian sum can be larger than the size of the block classification unit. Here, the thin solid-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0407] As shown in Figure 20 , regardless of the direction of the one-dimensional Laplacian operation, the specific sample positions for performing the one-dimensional Laplacian operation are the same. Additionally, as shown in Figure 20 , the pattern of the sample positions for performing the one-dimensional Laplacian calculation can be referred to as a checkerboard pattern or a plum blossom pattern. Additionally, the sample positions for performing the one-dimensional Laplacian operation are even or odd sample positions in both the horizontal direction (X-axis direction) and the vertical direction (Y-axis direction) within the one-dimensional Laplacian operation range in a block classification unit or a block unit.

[0408] As shown in Figure 21 , when performing block classification based on a 4×4-sized block, the sum g of the gradient values 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 respectively represent the results of sample - based one - dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one - dimensional Laplacian operations are respectively performed in positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. Additionally, the positions where the one - dimensional Laplacian operations are performed can be subsampled positions. In Figure 21 a block classification index C is assigned to the shaded 4×4 - sized 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 - line rectangle represents the reconstructed sample positions, and the thick solid - line rectangle represents the operation range for calculating the one - dimensional Laplacian sum.

[0409] As Figure 22 shown in, when block classification is performed based on 4×4 - sized blocks, the sum g of gradient values 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 respectively represent the results of sample - based one - dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one - dimensional Laplacian operations are respectively performed in positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. Additionally, the positions where the one - dimensional Laplacian operations are performed can be subsampled positions. In Figure 22 a block classification index C is assigned to the shaded 4×4 - sized 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 - line rectangle represents the reconstructed sample positions, and the thick solid - line rectangle represents the operation range for calculating the one - dimensional Laplacian sum.

[0410] As Figure 23 shown in, when block classification is performed based on each 4×4 - sized block, the sum g of gradient values is calculated at one or more specific sample positions v g h g d1 and g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of sample - based one - dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one - dimensional Laplacian operations are respectively performed in positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. Additionally, the positions where the one - dimensional Laplacian operations are performed can be subsampled positions. In Figure 23Among them, the block classification index C is assigned to the shaded 4×4-sized 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0411] As Figure 23 shown in, regardless of the one-dimensional Laplacian operation direction, the specific sample positions for performing the one-dimensional Laplacian operation are the same. Additionally, as Figure 23 shown in, the pattern of the sample positions for performing the one-dimensional Laplacian calculation can be referred to as a checkerboard pattern or a plum blossom pattern. Additionally, in two directions or any one of the horizontal direction (X-axis direction) and the vertical direction (Y-axis direction) within the one-dimensional Laplacian operation range in the block classification unit or the block unit, all the sample positions for performing the one-dimensional Laplacian operation are even or odd sample positions.

[0412] As Figure 24 shown in, when performing block classification based on each 4×4-sized block, the sum g v of the gradient values is calculated at one or more specific sample positions h 、g d1 and g d2 among at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction at positions V, H, D1, and D2. Additionally, the positions for performing the one-dimensional Laplacian operation can be subsampled positions. In Figure 24 among them, the block classification index C is assigned to the shaded 4×4-sized 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0413] As Figure 24 shown in, regardless of the one-dimensional Laplacian operation direction, the specific sample positions for performing the one-dimensional Laplacian operation are the same. Additionally, as Figure 24 shown in, the pattern of the sample positions for performing the one-dimensional Laplacian operation can be referred to as a checkerboard pattern or a plum blossom pattern. Additionally, the sample positions for performing the one-dimensional Laplacian operation are even or odd sample positions in two directions or any one of the horizontal direction (X-axis direction) and the vertical direction (Y-axis direction) within the one-dimensional Laplacian operation range of the block classification unit or the block unit.

[0414] As Figure 25As shown in, when performing block classification based on each 4×4-sized block, the sum g of gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are respectively performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions where the one-dimensional Laplacian operations are performed can be subsampled positions. In Figure 25 , the block classification index C is assigned to the shaded 4×4-sized 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum

[0415] As Figure 26 shown in, when performing block classification based on each 4×4-sized block, the sum g of gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are respectively performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. In Figure 26 , the block classification index C is assigned to the shaded 4×4-sized 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum. The specific sample positions can refer to each sample position within the block classification unit

[0416] As Figure 27 shown in, when performing block classification based on each 4×4-sized block, the sum g of gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed in the positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. Additionally, the positions where the one-dimensional Laplacian operations are performed can be the subsampled positions. In Figure 27 a block classification index C is assigned to the shaded 4×4-sized 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-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0417] As Figure 28 shown in, when block classification is performed based on each 4×4-sized block, the sum g of the gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2 at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed in the positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. In Figure 28 a block classification index C is assigned to the shaded 4×4-sized block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be greater than the size of the block classification unit. Here, the thin solid-line rectangle represents the reconstructed sample positions, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum. The specific sample positions can refer to each sample position within the block classification unit.

[0418] As Figure 29 shown in, when block classification is performed based on each 4×4-sized block, the sum g of the gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2 at least one of them. Here, V, H, D1, and D2 respectively represent the results of the sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed in the positions V, H, D1, and D2 along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. In Figure 29In , the block classification index C is assigned to the shaded 4×4 sized 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 line rectangle represents the reconstructed sample positions, and the thick solid line rectangle represents the operation range for calculating the one-dimensional Laplacian sum. A specific sample position can refer to each sample position within the block classification unit.

[0419] As Figure 30 shown in , when block classification is performed based on each 4×4 sized block, the sum g of gradient values is calculated at one or more specific sample positions v 、g h 、g d1 and g d2 at least one of. Here, V, H, D1, and D2 respectively represent the results of sample-based one-dimensional Laplacian operations in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are performed in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed can be sub-sampled positions. In Figure 30 In , the block classification index C is assigned to the shaded 4×4 sized 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 line rectangle represents the reconstructed sample positions, and the thick solid line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0420] According to an embodiment of the present invention, at least one of the methods for calculating gradient values can be performed based on a time layer identifier.

[0421] For example, when block classification is performed based on each 2×2 sized block, Equation 2 to Equation 5 can be jointly expressed by one equation as shown in Equation 14.

[0422] [Equation 14]

[0423]

[0424] In Equation 14, dir represents the horizontal direction, vertical direction, first diagonal direction, and second diagonal direction, and g dir represents each of the sums of gradient values in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. Additionally, i and j respectively represent the horizontal position and vertical position in the 2×2 sized block, and G dir represents each of the results of one-dimensional Laplacian operations in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction.

[0425] In this case, when the time layer identifier of the current picture (or reconstructed picture) indicates the top layer, and block classification is performed based on each 2×2-sized block within the current picture (or reconstructed picture), Equation 14 can be expressed as Equation 15.

[0426] [Equation 15]

[0427] g 2×2,dir = |G dir (i 0 ,j 0 )|

[0428] In Equation 15, G dir (i 0 ,j 0 ) represents the gradient value at the upper-left position within a 2×2-sized block along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction.

[0429] Figure 31 is a diagram showing an exemplary method for determining the gradient values along the horizontal, vertical, first diagonal, and second diagonal directions for the case where the time layer identifier indicates the top layer.

[0430] Referring to Figure 31 , the sum g v , g h , g d1 and g d2 of the gradient values along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction can be simplified by calculating the gradient only at the upper-left sample position (i.e., the shaded sample position) within each 2×2-sized block.

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

[0432] Applying the weight or calculating the weighted sum can be determined based on various conditions or coding parameters associated with the current block and neighboring blocks.

[0433] For example, the weighted sum can be calculated in units of at least one of samples, sample groups, lines, and blocks. In this case, the weighted sum can be calculated by changing the weight in units of at least one of samples, sample groups, lines, and blocks.

[0434] For example, the weight can 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.

[0435] For example, a weighted sum may be calculated according to conditions preset in an encoder and a decoder.

[0436] For example, weights are adaptively determined based on at least one of encoding parameters such as block size, block shape, and intra prediction mode of at least one of a current block and neighboring blocks.

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

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

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

[0440] Information on weights and / or whether to perform weighted sum calculation may be entropy-coded in an encoder and then signaled to a decoder.

[0441] According to an embodiment of the present invention, when calculating sums g v 、g h 、g d1 and g d2 of gradient values along vertical, horizontal, first diagonal, and second diagonal directions, when there is one or more unavailable samples around a current sample, padding is performed on the unavailable samples and the padded samples may be used to calculate gradient values. Padding refers to a method of copying sample values of adjacent available samples to unavailable samples. Optionally, sample values or statistical values obtained based on sample values of available samples adjacent to unavailable samples may be used. Padding may be repeatedly performed for P columns and R rows. Here, both P and R are positive integers.

[0442] Here, unavailable samples refer to samples set outside boundaries of a CTU, CTB, stripe, parallel block, parallel block group, or picture. Optionally, unavailable samples may refer to samples belonging to at least one of a CTU, CTB, stripe, parallel block, parallel block group, and picture, where at least one of the CTU, CTB, stripe, parallel block, parallel block group, and picture is different from at least one of the CTU, CTB, stripe, parallel block, parallel block group, and picture to which the current sample belongs.

[0443] According to an embodiment of the present invention, when calculating at least one of the sums g v 、g h 、g d1 and g d2 along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction respectively, a predetermined sample point may not be used.

[0444] For example, when calculating at least one of the sums g v 、g h 、g d1 and g d2 along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction respectively, a padding sample point may not be used.

[0445] Optionally, for example, when calculating each of the sums g v 、g h 、g d1 and g d2 along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction respectively, when there is one or more unavailable sample points around the current sample point, the unavailable sample points may not be used for calculating the gradient value.

[0446] Further optionally, for example, when calculating at least one of the sums g v 、g h 、g d1 and g d2 along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction respectively, when the sample points around the current sample point are outside the CTU or CTB, the neighboring sample points adjacent to the current sample point may not be used.

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

[0448] According to an embodiment of the present invention, a predetermined sample point may not be used in the one-dimensional Laplacian calculation.

[0449] For example, in the one-dimensional Laplacian calculation, a padding sample point may not be used.

[0450] Optionally, for example, when calculating at least one of the one-dimensional Laplacian operation values, when there is one or more unavailable sample points around the current sample point, the one or more unavailable sample points may not be used for the one-dimensional Laplacian operation.

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

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

[0453] According to an embodiment of the present invention, when calculating the sum g of the gradient values along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction v , g h , g d1 and g d2 in at least one of them, or when calculating at least one of the one-dimensional Laplacian operation values, when the samples around the current block are arranged 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.

[0454] Optionally, when calculating the sum g of the gradient values along the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction v , g h , g d1 and g d2 in at least one of them, or when calculating at least one of the one-dimensional Laplacian operation values, when the samples around the current block are arranged 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.

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

[0456] According to an embodiment of the present invention, when there are unavailable samples within the block classification unit or outside the CTU or CTB, the 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.

[0457] On the other hand, when calculating the gradient value based on subsampling, the one-dimensional Laplacian operation is performed on the subsampled points within the operation range instead of all the sample points within the operation range for calculating the one-dimensional Laplacian operation. Therefore, the number of operations (such as multiplication, shift operation, addition, and absolute value operation) required for block classification can be reduced. In addition, the memory access bandwidth required for using the reconstructed sample points can also be reduced. Therefore, the complexity of the encoder and decoder is also reduced. Specifically, since the time required for block classification can be reduced, it is beneficial to perform the one-dimensional Laplacian operation on the subsampled points in terms of the hardware complexity of the encoder and decoder.

[0458] In addition, when the operation range for calculating the sum of the one-dimensional Laplacian operation is equal to or smaller than the size of the block classification unit, the number of additions required for block classification can be reduced. In addition, the memory access bandwidth required for using the reconstructed sample points can also be reduced. Therefore, the complexity of the encoder and decoder can also be reduced.

[0459] On the other hand, in the gradient value calculation method based on subsampling, by changing at least one of the sample point position, the number of sample points, and the direction of the sample point position for performing the one-dimensional Laplacian operation according to the gradient values with respect to the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction, the sums g v 、g h 、g d1 and g d2 of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction are calculated.

[0460] In addition, in the gradient value calculation method based on subsampling, regardless of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction, by using at least one same factor among the sample point position, the number of sample points, and the direction of the sample point position for performing the one-dimensional Laplacian operation, the sums g v 、g h 、g d1 and g d2 of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction are calculated.

[0461] In addition, by using any combination of the above one or more gradient value calculations, the one-dimensional Laplacian operation can be performed for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction, and the sums g v 、g h 、g d1 and g d2 of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction can be calculated.

[0462] According to an embodiment of the present invention, the sum g of the gradient values along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction v , g h , g d1 and g d2 are compared with two or more of the values with each other.

[0463] For example, after calculating the sum of the gradient values, the sum g of the gradient values for the vertical direction v is compared with the sum g of the gradient values for the horizontal direction h , and the maximum and minimum values of the sum of the gradient values for the vertical direction and the sum of the gradient values for the horizontal direction are derived according to Equation 16.

[0464] [Equation 16]

[0465]

[0466] In this case, in order to compare the sum g of the gradient values for the vertical direction v with the sum g of the gradient values for the horizontal direction h , the values of the sums are compared according to Equation 17.

[0467] [Equation 17]

[0468]

[0469] Optionally, for example, the sum g of the gradient values for the first diagonal direction d1 is compared with the sum g of the gradient values for the second diagonal direction d2 , and the maximum value and the minimum value

[0470] [Equation 18]

[0471]

[0472] In this case, in order to compare the sum g of the gradient values for the first diagonal direction d1 with the sum g of the gradient values for the second diagonal direction d2 , the values of the sums are compared according to Equation 19.

[0473] [Equation 19]

[0474]

[0475] According to an embodiment of the present invention, in order to calculate the directivity value D, as described below, two thresholds t are used1 and t 2 Compare the maximum value with the minimum value.

[0476] The directivity value D is a positive integer or zero. For example, the directivity value D can be a value within the range from 0 to 4. For example, the directivity value D can be a value within the range from 0 to 2.

[0477] In addition, the directivity value D can be determined according to the characteristics of the region. For example, the directivity values Ds 0 to Ds 4 are represented as follows: 0 represents a texture 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 by the steps described below.

[0478] Step 1: When and are satisfied, set the value D to 0

[0479] Step 2: When is satisfied, go to Step 3, and when it is not satisfied, go to Step 4

[0480] Step 3: When is satisfied, set the value D to 2, and when it is not satisfied, set the value D to 1

[0481] Step 4: When is satisfied, set the value D to 4, and when it is not satisfied, set the value D to 3

[0482] where the threshold t 1 and t 2 are positive integers, and t 1 and t 2 can be the same value or different values. For example, t 1 and t 2 are 2 and 9 respectively. In another example, t 1 and t 2 are both 1. In another example, t 1 and t 2 are 1 and 9 respectively.

[0483] When performing block classification based on a 2×2 size block, the activity value A can be expressed as Expression 20.

[0484] [Equation 20]

[0485]

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

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

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

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

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

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

[0492] In addition, when performing block classification based on a 4×4-sized block, the activity value A can be expressed as Expression 21.

[0493] [Equation 21]

[0494]

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

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

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

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

[0499] For example, the operation range for calculating the sum of the results of one-dimensional Laplacian operations 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 four-leaf clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0500] In addition, when performing block classification based on a 2×2 size block, the activity value A may be expressed as Expression 22. Here, at least one of the one-dimensional Laplacian operation values for the first diagonal direction and the second diagonal direction may be additionally used for the calculation of the activity value A.

[0501] [Equation 22]

[0502]

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

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

[0505] Further optionally, 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 one-dimensional Laplacian operations is of 6×6 size.

[0506] Further optionally, 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 one-dimensional Laplacian operations is of 4×4 size.

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

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

[0509] In addition, when performing block classification based on a 4×4 size block, the activity value A may be expressed as Expression 23. Here, at least one of the one-dimensional Laplacian operation values for the first diagonal direction and the second diagonal direction may be additionally used to calculate the activity value A.

[0510] [Equation 23]

[0511]

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

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

[0514] Further optionally, for example, k is in the range from i - 2 to i + 5, and l is in the range 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.

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

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

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

[0518] A predetermined method may be used to determine the quantized activity value A q .

[0519] For example, the quantized activity value A may be determined by Equation 24 qIn this case, the quantized activity value Aq can be included within a range from a specific minimum value X to a specific maximum value Y.

[0520] [Equation 24]

[0521]

[0522] 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 operation R 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. Optionally, for example, W is 64 and R is 3 + N (bits). For example, N is a positive integer, specifically 8 or 10. In another example, W is 32 and R is 3 + N (bits). Optionally, for example, N is a positive integer, specifically 8 or 10.

[0523] Further optionally, for example, the quantized activity value A is calculated using a look-up table (LUT). q and a mapping relationship between the activity value A and the quantized activity value A is set. That is, an operation is performed on the activity value A, and the quantized activity value A is calculated using a look-up table. q In this case, the operation may include at least one of multiplication, division, right shift operation, left shift operation, addition, and subtraction. q On the other hand, in the case of a chrominance component, filtering is performed for each chrominance component using K filters without performing block classification processing. Here, K is a positive integer or zero. For example, K is 1. Additionally, in the case of a chrominance component, block classification may not be performed on the chrominance component, and filtering may be performed using a block classification index derived from the luminance component at the corresponding position of the chrominance component. Additionally, in the case of a chrominance component, filter information for the chrominance component may not be signaled, and a fixed type of filter may be used.

[0524] is a diagram showing various calculation methods that can be used to replace a one-dimensional Laplacian operation according to an embodiment of the present invention.

[0525] Figure 32 According to an embodiment of the present invention, at least one of the calculation methods shown in

[0526] can be used to replace a one-dimensional Laplacian operation. Referring to Figure 32 Figure 32 ​, the calculation methods include two-dimensional Laplacian, two-dimensional Sobel, two-dimensional edge extraction, and two-dimensional Laplacian of Gaussian (LoG) operations. Here, the LoG operation means applying the combination of a Gaussian filter and a Laplacian filter to the reconstructed 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 to replace the one-dimensional Laplacian operation. Optionally, a Difference of Gaussian (DoG) operation can be used. Here, the DoG operation means applying the combination of Gaussian filters with different internal parameters to the reconstructed sample points.

[0527] In addition, in order to calculate the directivity value D or the activity value A, an LoG operation of N×M size can be used. Here, both M and L are positive integers. For example, use Figure 32 at least one of the 5×5 two-dimensional LoG shown in (i) of Figure 32 and the 9×9 two-dimensional LoG operation shown in (j) of

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

[0529] A representative vector can be calculated such that the gradient vectors within a predetermined window size (e.g., a 6×6 size block) satisfy the condition of Equation 25. The direction and deformation can be identified according to θ.

[0530] [Equation 25]

[0531]

[0532] The inner product shown in Equation 26 can be used to calculate the similarity between the representative vector and each gradient vector within the window.

[0533] [Equation 26]

[0534]

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

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

[0537] Step 2: When θ ∈ (D0 or D1) and S > th 2When the condition is met, set the value of D to 2, and when the condition is not met, set the value of D to 1.

[0538] Step 3: When θ∈(VorH) and S<th are satisfied 2 set the value of D to 4, and when the condition is not met, set the value of D to 3.

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

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

[0541] [Equation 27]

[0542] For k = 0,…,K - 1

[0543] 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 classification index k∈{0,…,K - 1} to the sample position (i,j). Additionally, is the set of all samples to which the classification index is assigned by the classifier D. The classification 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. Given a class with a classification index k∈{0,…,k - 1} perform the following steps.

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

[0545] 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 of the sample points s′(i,j) according to Equation 28.

[0546] [Equation 28]

[0547]

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

[0549] When classification_idx = 2, the sample - based feature classifier based on sorting can be used Used as a classifier. Represented by Equation 30. r 8 (i, j) is a classifier that compares s′(i, j) with the adjacent 8 samples and arranges the samples in the order of their values.

[0550] [Equation 29]

[0551]

[0552] Classifier r 8 The value of (i, j) ranges from 0 to 8. When the sample s′(i, j) is the largest sample within a 3×3 size block centered at (i, j), r 8 The value of (i, j) is zero. When s′(i, j) is the second largest sample, r 8 The value of (i, j) is 1.

[0553] [Equation 30]

[0554]

[0555] In Equation 30, T 1 and T 2 are predefined thresholds. That is, the dynamic range of the samples is divided into three bands, and the sorting of the local samples in each band is used as an additional criterion. The sample-based feature classifier based on sorting provides 27 classes (K = 27).

[0556] When classification_idx = 3, a classifier based on sorting and regional change is used Can be represented by Equation 31.

[0557] [Equation 31]

[0558]

[0559] In Equation 31, T 3 or T 4 is a predefined threshold. The local change v(i, j) at each sample position (i, j) can be represented by Equation 32.

[0560] [Equation 32]

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

[0562] In addition to each sample being first classified into one of three classes based on the local variable |v(i, j)|, is related to The same classifier. Next, within each class, the sorting of nearby local samples can be used as an additional criterion for providing 27 classes.

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

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

[0565] In addition, in the case of the similarity classifier, adjacent samples in a 5×5 diamond filter are compared with a filtering target sample which is the sample to be filtered. The group index of the sample to be filtered can be initialized to 0. When the difference between the adjacent sample and the filtering target sample is larger than a predefined threshold, the group index is incremented by 1. Furthermore, when the difference between the adjacent sample and the filtering target sample is larger than twice the predefined threshold, the group index is incremented by one additionally. In this case, the similarity classifier has 25 groups.

[0566] In addition, in the case of the Rot BA classifier, the operation range for calculating the sum of one-dimensional Laplacian operations for a 2×2 block is reduced from 6×6 size to 4×4 size. This classifier has at most 25 groups. Among multiple classifiers, there can be at most 25 groups or 32 groups. However, the number of filters in the slice filter bank is limited to at most 16 groups. That is, the encoder combines consecutive groups such that the number of combined groups remains 16 or less.

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

[0568] In one example, block classification is determined according to quantization parameters. For example, when the quantization parameter is less than a threshold T, J block classification indices are used. When the quantization parameter is greater than a threshold 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. In addition, J is greater than or equal to H. Here, the larger the quantization parameter value, the fewer the number of block classification indices used.

[0569] In another example, the number of block classifications is determined according to the size of the current block. For example, when the size of the current block is less than a threshold T, J block classification indices are used. When the size of the current block is greater than a threshold 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. In addition, J is greater than or equal to H. Here, the larger the block size, the fewer the number of block classification indices used.

[0570] In another example, the number of block classifications is determined according to the size of the block classification unit. For example, when the size of the block classification unit is less than a threshold T, J block classification indices are used. When the size of the block classification unit is greater than a threshold 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. Additionally, J is greater than or equal to H. Here, the larger the size of the block classification unit, the fewer the number of block classification indices used.

[0571] According to an embodiment of the present invention, at least one of the sum of the gradient values at the same position in the previous picture, the sum of the gradient values of the neighboring blocks around the current block, and the sum of the gradient values of the neighboring block classification units around the current block classification unit is determined as 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. Here, the co-located samples in the previous picture are the spatial positions or neighboring positions of the reconstructed samples in the current picture of the previous picture.

[0572] For example, when at least one of the sum of the gradient values g v and g h in the vertical and horizontal directions of the current block unit and at least one of 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, at least one of the sum of the gradient values g d1 and g d2 in the first diagonal direction and the second diagonal direction of the neighboring block classification unit of the current block classification unit 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.

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

[0574] In another example, when the difference between at least one statistical value of the reconstructed samples within the current block unit and at least one statistical value of the reconstructed samples within the neighboring block classification units around the current block classification unit is equal to or less than the threshold E, at least one of the sum of the gradient values of the neighboring block classification units around the current block unit is determined as at least one of the sum 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 the spatial neighboring blocks and / or temporal neighboring blocks of the current block. In addition, the threshold E is a value predefined in the encoder and the decoder.

[0575] According to an embodiment of the present invention, at least one of the block classification indices of the co-located samples in the previous picture, the block classification indices of the neighboring blocks of the current block, and the block classification indices of the neighboring block classification units of the current block classification unit is determined as at least one of the block classification indices of the current block and the block classification indices of the current block classification unit.

[0576] For example, when the difference between at least one of the sum of the gradient values g v and g h in the vertical and horizontal directions for the current block unit and at least one of the sum of the gradient values in the vertical and horizontal directions for the neighboring block classification units around the current block classification unit is equal to or less than the 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.

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

[0578] Further optionally, for example, when the difference between at least one statistical value of the reconstructed samples within the current block unit and at least one statistical value of the reconstructed samples within the neighboring block classification units around the current block classification unit is equal to or less than the threshold E, the block classification index of the neighboring block classification unit around 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.

[0579] Further optionally, for example, at least one of the combinations of the above-described block classification index determination methods may be used to determine the block classification index.

[0580] Hereinafter, the sub-steps of filter execution will be described.

[0581] 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 the reconstructed / decoded picture. When performing filtering, one filter out of L filters is selected. L is a positive integer or zero.

[0582] For example, one filter out of L filters is selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each reconstructed / decoded sample.

[0583] Optionally, for example, one filter out of L filters is selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each block classification unit.

[0584] Further optionally, for example, one filter out of L filters is selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each CU.

[0585] Further optionally, for example, one filter out of L filters is selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each block.

[0586] Further optionally, for example, U filters out of L filters are selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each reconstructed / decoded sample. Here, U is a positive integer.

[0587] Further optionally, for example, U filters out of L filters are selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each block classification unit. Here, U is a positive integer.

[0588] Further optionally, for example, U filters out of L filters are selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each CU. Here, U is a positive integer.

[0589] Further optionally, for example, U filters out of L filters are selected based on each block classification unit, and filtering is performed on the reconstructed / decoded picture based on each block. Here, U is a positive integer.

[0590] Here, the L filters are referred to as a filter bank.

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

[0592] For example, in units of blocks, CUs, PUs, TUs, CTUs, stripes, parallel blocks, parallel block groups, pictures, and sequences, the L filters are common in at least one of filter coefficients, the number of filter taps (filter length), filter coefficients, filter shape, and filter type.

[0593] Optionally, for example, in units of CUs, PUs, TUs, CTUs, stripes, parallel blocks, parallel block groups, pictures, and sequences, the L filters are common in at least one of filter coefficients, the number of filter taps (filter length), filter shape, and filter type.

[0594] The same filter or different filters can be used to perform filtering in units of CUs, PUs, TUs, CTUs, stripes, parallel blocks, parallel block groups, pictures, and sequences.

[0595] Based on the filtering execution information on whether to perform filtering in units of samples, blocks, CUs, PUs, TUs, CTUs, stripes, parallel blocks, parallel block groups, pictures, and sequences, filtering can be performed or not. The filtering execution information on whether to perform filtering is information signaled from the encoder to the decoder in units of samples, blocks, CUs, PUs, TUs, CTUs, stripes, parallel blocks, parallel block groups, pictures, and sequences.

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

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

[0598] Referring to Figure 33 , in order to signal the information of the filters in three diamond filters with 5×5, 7×7, or 9×9 filter taps from the encoder to the decoder, entropy coding / decoding of the filter index is performed based on each picture / parallel block / parallel block group / stripe / sequence. That is, entropy coding / decoding of the filter index is performed in the bitstream with the sequence parameter set, picture parameter set, stripe header, stripe data, parallel block header, parallel block group header, header, etc.

[0599] 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 7×7 diamond filter with filter taps is used for the luminance component, and a 5×5 diamond filter with filter taps is used for the chrominance component.

[0600] 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 luminance component and the chrominance component.

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

[0602] Optionally, for example, a 5×5 diamond-shaped filter shown in Figure 33 is used to filter the reconstructed / decoded chrominance samples.

[0603] Further optionally, for example, the filter used to filter the luminance samples is used to filter the reconstructed / decoded chrominance samples corresponding to the luminance samples.

[0604] In addition, the numbers in each filter shape shown in Figure 33 represent filter coefficient indices, and the filter coefficient indices are symmetric with respect to the filter center. That is, the filter shown in Figure 33 is a point-symmetric filter.

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

[0606] In addition, for the 9×9 diamond filter shown in (a) of Figure 33 , a total of 21 multiplications are required for each sample. For the 7×7 diamond filter shown in (b) of Figure 33 , a total of 13 multiplications are required for each sample. For the 5×5 diamond filter shown in (c) of Figure 33 , a total of 7 multiplications are required for each sample. That is, at most 21 multiplications are used to perform filtering for each sample.

[0607] In addition, as shown in (a) of Figure 33 , since the size of the 9×9 rhombus filter is 9×9, four line buffers, which are half the length of the vertical filter, are required for hardware implementation. That is, at most four line buffers are required.

[0608] According to an embodiment of the present invention, the filter has the same filter length representing 5×5 filter taps, but may have different filter shapes selected from a rhombus, rectangle, square, trapezoid, diagonal, snowflake, hash, four-leaf clover, cross, triangle, pentagon, hexagon, octagon, decagon, and dodecagon. For example, in Figure 34 , square, octagon, snowflake, and rhombus filters having 5×5 filter taps are shown.

[0609] The number of filter taps is not limited to 5×5. Filters having H×V filter taps selected from 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 can be used. Here, H and V are positive integers and are the same value or different values. In addition, at least one of H and V is a value predefined in the encoder / decoder and a value signaled from the encoder to the decoder. In addition, one of H and V is used to define the other of H and V. Furthermore, the values of H and V can be used to define the final value of H or V.

[0610] On the other hand, in order to signal from the encoder to the decoder which filter among the filters shown in Figure 34 will be used, the filter index can be entropy-coded / decoded based on each picture / parallel block / parallel block group / strip / sequence. That is, the filter index is entropy-coded / decoded as a sequence parameter set, picture parameter set, strip header, strip data, parallel block header, and parallel block group header within the bitstream.

[0611] On the other hand, at least one of the square, octagon, snowflake, and rhombus filters shown in Figure 34 is used to filter at least one reconstructed / decoded sample of at least one of the luminance component and the chrominance component.

[0612] On the other hand, in each filter shape shown in Figure 34 , the numbers represent filter coefficient indices, and the filter coefficient indices are symmetric with respect to the filter center. That is, the filters shown in Figure 34 are point-symmetric filters.

[0613] According to an embodiment of the present invention, when filtering a reconstructed picture based on each sample point, it is possible to determine which filter shape to use for each picture, slice, parallel block, or group of parallel blocks in terms of rate-distortion optimization in the encoder. Additionally, filtering is performed using the determined filter shape. As Figure 34 shown, since the degree of improvement in coding efficiency and the amount of filter information (the number of filter coefficients) vary according to the filter shape, it is necessary to determine the optimal filter shape for each picture, slice, parallel block, or group of parallel blocks. That is, the optimal filter shape among the filter shapes shown in Figure 34 is determined differently according to video resolution, video characteristics, bit rate, etc.

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

[0615] For example, in the case of the 5×5 square filter shown in (a) of Figure 34 , a total of 13 filter coefficients are entropy-coded / decoded. In the case of the 5×5 octagon filter shown in (b) of Figure 34 , a total of 11 filter coefficients are entropy-coded / decoded. In the case of the 5×5 snowflake filter shown in (c) of Figure 34 , a total of 9 filter coefficients are entropy-coded / decoded. And in the case of the 5×5 diamond filter shown in (c) of Figure 34 , a total of 7 filter coefficients are entropy-coded / decoded. That is, the number of filter coefficients to be entropy-coded / decoded varies according to the filter shape. Here, the maximum number of filter coefficients of the filter in the example of Figure 34 (i.e., 13) is less than the maximum number of filter coefficients of the filter in the example of Figure 33 (i.e., 21). Therefore, when using the filter in the example of Figure 34 , the number of filter coefficients to be entropy-coded / decoded is reduced. Thus, in this case, the computational complexity of the encoder / decoder can be reduced.

[0616] Optionally, for example, for the 5×5 square filter shown in (a) of Figure 34 , a total of 13 multiplications are required for each sample point. For the 5×5 octagon filter shown in (b) of Figure 34 , a total of 11 multiplications are required for each sample point. For the 5×5 snowflake filter shown in (c) of Figure 34 , a total of 9 multiplications are required for each sample point. And for the Figure 34The 5×5 rhombic filter shown in (d) of [the relevant part] requires a total of 7 multiplications per sample. In Figure 34 the maximum number of filter coefficients of the filter in the example of [reference] (i.e., 13) is less than that in Figure 33 the maximum number of filter coefficients of the filter in the example of [another reference] (i.e., 21). Therefore, when using Figure 34 the filter in the example of [a certain reference], the number of multiplications per sample is reduced. Thus, in this case, the computational complexity of the encoder / decoder can be reduced.

[0617] Alternatively, for example, since all the filters in Figure 34 the example of [a reference] are of size 5×5, hardware implementation requires two line buffers that are half the length of the vertical filter. Here, the number of line buffers required for using the filter in Figure 34 the example of [a reference] (i.e., two line buffers) is less than the number of line buffers required for using the filter in Figure 33 the example of [another reference] (i.e., four line buffers). Therefore, when using Figure 34 the filter in the example of [a reference], the size of the line buffer, the hardware complexity of the encoder / decoder, the memory capacity requirement, and the memory access bandwidth can be reduced.

[0618] According to an embodiment of the present invention, as the filter used in the above filtering process, a filter having at least one shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a four-leaf clover shape, a cross shape, a triangle, a pentagon, a hexagon, an octagon, a decagon, and a dodecagon is used. For example, as shown in Figure 35a and / or Figure 35b , the filter may have a shape selected from a square, an octagon, a snowflake shape, a rhombus, a hexagon, a rectangle, a cross shape, a number sign shape, a four-leaf clover shape, and a diagonal shape.

[0619] For example, at least one of the filters with a vertical length of 5 in Figure 35a and / or Figure 35b shown is used to construct a filter bank, and then the filter bank is used to perform filtering.

[0620] Optionally, for example, at least one of the filters with a vertical filter length of 3 in Figure 35a and Figure 35b shown is used to construct a filter bank, and then the filter bank is used to perform filtering.

[0621] Further optionally, for example, at least one of the filters in Figure 35a and / or Figure 35bConstruct a filter bank using at least one of the filters with a vertical filter length of 3 or 5 shown in []. Perform filtering using this filter bank.

[0622] In Figure 35a and Figure 35b The filters shown in are 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 to this. The filter can be designed to have an arbitrary vertical filter length M. Here, M is a positive integer.

[0623] On the other hand, prepare H filter banks using the filters shown in Figure 35a and / or Figure 35b Transmit the information of which filter to use from the encoder to the decoder by signal. In this case, entropy encode / decode the filter index based on each picture, parallel block, parallel block group, slice, or sequence. Here, H is a positive integer. That is, entropy encode / decode the filter index into a sequence parameter set, picture parameter set, slice header, slice data, parallel block header, and parallel block group header within the bitstream.

[0624] Use at least one of a diamond, rectangle, square, trapezoid, diagonal, snowflake, hash, clover, cross, triangle, pentagon, hexagon, octagon, and decagon filter to filter the reconstructed / decoded samples of at least one of the luminance component and the chrominance component.

[0625] On the other hand, in Figure 35a and / or Figure 35b The numbers in each filter shape shown in represent filter coefficient indices, and the filter coefficient indices are symmetric with respect to the filter center. That is, Figure 35a and / or Figure 35b The filter shapes shown in are point-symmetric filters.

[0626] According to an embodiment of the present invention, compared with using the filter in the example such as Figure 33 , using the filter in the examples such as Figure 35a and / or Figure 35b has the advantage of reducing the computational complexity of the encoder / decoder.

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

[0628] Optionally, for example, when usingFigure 35a and / or Figure 35b at least one of the filters shown in Figure 33 compared with the case of using one of the 9×9 rhombic filters shown in

[0629] Further optionally, for example, when using at least one of the filters shown in Figure 35a and / or Figure 35b compared with the case of using one of the 9×9 rhombic filters shown in Figure 33 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.

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

[0631] For example, at least one filter with a vertical filter length of 5 in the filters shown in Figure 36 is used to construct a filter bank, and then the filter bank is used to perform filtering.

[0632] Optionally, for example, at least one filter with a vertical filter length of 3 in the filters shown in Figure 36 is used to form a filter bank, and then the filter bank is used for filtering.

[0633] Further optionally, for example, at least one filter with a vertical filter length of 3 or 5 in the filters shown in Figure 36 is used to construct a filter bank, and the filter bank is used to perform filtering.

[0634] In Figure 36 the filter shape shown 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.

[0635] To prepare for inclusion in Figure 36a filter bank of H filters in the filter shown, and information as to which filter in the filter bank will be used is signaled from the encoder to the decoder, and the filter index is entropy-coded / decoded based on each picture, parallel block, group of parallel blocks, slice, or sequence. Here, H is a positive integer. That is, the filter index is entropy-coded / decoded into a sequence parameter set, a picture parameter set, a slice header, slice data, a parallel block header, and a group of parallel blocks header within a bitstream.

[0636] At least one of a rhombus, rectangle, square, trapezoid, diagonal, snowflake, hash, clover, cross, triangle, pentagon, hexagon, octagon, and decagon filter is used to filter reconstructed / decoded samples of at least one of a luminance component and a chrominance component.

[0637] According to an embodiment of the present invention, compared to using a filter as shown in Figure 33 using a filter as shown in Figure 36 has the advantage of reducing the computational complexity of an encoder / decoder.

[0638] For example, when using at least one of the filters shown in Figure 36 the number of filter coefficients to be entropy-coded / decoded is reduced compared to the case of using one of the 9×9 rhombus filters shown in Figure 33 Accordingly, the computational complexity of the encoder / decoder can be reduced.

[0639] Optionally, for example, when using at least one of the filters shown in Figure 36 the number of multiplications required to filter filter coefficients is reduced compared to the case of using one of the 9×9 rhombus filters shown in Figure 33 Accordingly, the computational complexity of the encoder / decoder can be reduced.

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

[0641] According to an embodiment of the present invention, before performing filtering based on each block classification unit, according to the sum of gradient values calculated based on each block classification unit (i.e., the sum g of gradient values in the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction v g h g d1 and g d2) at least one of them performs a geometric transformation on the filter coefficient f(k, l). In this case, the geometric transformation of the filter coefficient is achieved by performing a 90° rotation, 180° rotation, 270° rotation, second diagonal flip, first diagonal flip, vertical flip, horizontal flip, vertical and horizontal flip, or zoom in / out on the filter, thereby generating a geometrically transformed filter.

[0642] On the other hand, after performing the geometric transformation on the filter coefficient, the reconstructed / decoded samples are filtered using the geometrically transformed filter coefficient. In this case, at least one of the reconstructed / decoded samples that are the filtering target is geometrically transformed, and then the reconstructed / decoded samples are filtered using the filter coefficient.

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

[0644] [Equation 33]

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

[0646] [Equation 34]

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

[0648] [Equation 35]

[0649] f R (k, l) = f(K - l - 1, k)

[0650] Here, Equation 33 is an example showing the equation for the second diagonal flip, Equation 34 is an example showing the vertical flip, and Equation 35 is an example showing the 90° rotation. In Equations 34 to 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 coefficient. For example, (0, 0) represents the upper left corner, and (K - 1, K - 1) represents the lower right corner.

[0651] Table 1 shows examples of the geometric transformation applied to the filter coefficient f(k, l) according to the sum of gradient values.

[0652] [Table 1]

[0653]

[0654]

[0655] Figure 37It is a view showing filters obtained by performing geometric transformations on a square filter, an octagonal filter, a snowflake filter, and a rhombus filter according to an embodiment of the present invention.

[0656] Referring to Figure 37 , at least one geometric transformation among 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 rhombus filter. Then, the filter coefficients obtained by the geometric transformation can be used for filtering. On the other hand, after performing the geometric transformation on the filter coefficients, the reconstructed / decoded samples are filtered using the filter coefficients obtained by the geometric transformation. In this case, at least one of the reconstructed / decoded samples to be filtered is geometrically transformed, and then the reconstructed / decoded samples are filtered using the filter coefficients.

[0657] According to an embodiment of the present invention, filtering is performed on the reconstructed / decoded sample R(i,j) to generate a filtered decoded sample R′(i,j). The filtered decoded sample can be represented by Equation 36.

[0658] [Equation 36]

[0659]

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

[0661] On the other hand, when filtering is performed, an offset value Y can be added to the filtered decoded sample R′(i,j). The offset value Y can be entropy-coded / decoded. In addition, the offset value Y is calculated using at least one statistical value of the current reconstructed / decoded sample value and the neighboring reconstructed / decoded sample values. Additionally, the offset value Y is determined based on at least one coding parameter of the current reconstructed / decoded sample and the neighboring reconstructed / decoded samples. Here, the threshold E is a positive integer or zero.

[0662] In addition, the filtered decoded sample can be clipped to be represented by N bits. Here, H is a positive integer. For example, when the filtered decoded sample generated by filtering the reconstructed / decoded sample is clipped to 10 bits, the final decoded sample value can be a value in the range from 0 to 1023.

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

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

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

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

[0667] Here, an unavailable sample refers to a sample arranged outside the boundaries of a CTU, CTB, stripe, parallel block, parallel block group, or picture. Optionally, an unavailable sample refers to a sample belonging to at least one of a CTU, CTB, stripe, parallel block, parallel block group, and picture different from at least one of the CTU, CTB, stripe, parallel block, parallel block group, and picture to which the current sample belongs.

[0668] In addition, when performing filtering, predetermined samples may not be used.

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

[0670] Optionally, for example, when performing filtering, when there are unavailable samples near the current sample, the unavailable samples may not be used during filtering.

[0671] Further optionally, for example, when performing filtering, when samples near the current sample are outside a CTU or CTB, the neighboring samples near the current sample may not be used during filtering.

[0672] In addition, when performing filtering, samples to which at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering has been applied may be used.

[0673] In addition, when performing filtering, when at least one of the samples near the current sample is outside the CTU or CTB boundary, at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering may not be applied.

[0674] In addition, the filtering target samples include unavailable samples outside the CTU or CTB boundary, at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering is not performed on the unavailable samples, and the unavailable samples are used for filtering as they are.

[0675] According to an embodiment of the present invention, when filtering is performed, filtering is performed on at least one sample among samples near the 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. Additionally, the samples near the boundary may be at least one of the U rows, U columns, and U samples adjacent to the boundary. Here, U is a positive integer.

[0676] According to an embodiment of the present invention, when filtering is performed, filtering is performed on at least one sample among samples within a block, and filtering is not performed on samples outside the 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. Additionally, the samples near the boundary may be at least one of the U rows, U columns, and U samples adjacent to the boundary. Here, U is a positive integer.

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

[0678] Additionally, when filtering is performed, at least one of a filter coefficient, the 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 a current block and neighboring blocks. At least one of a filter coefficient, the number of filter taps (filter length), a filter shape, and a filter type varies according to at least one of the coding parameters.

[0679] For example, the number of filters used for filtering is determined according to the quantization parameter. For example, when the quantization parameter is less than a threshold T, J filters are used. When the quantization parameter 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. Additionally, J is greater than or equal to H. Here, the larger the quantization parameter value, the fewer the number of filters used.

[0680] Optionally, for example, the number of filters used for filtering is determined according to 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. In addition, J is greater than or equal to H. Here, the larger the block size, the fewer the number of block filters used.

[0681] Optionally, for example, the number of filters used for filtering is determined according to the size of the block classification unit. For example, when the size of the block classification unit is less than a threshold T, J filters are used. When the size of the block classification unit 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. Additionally, J is greater than or equal to H. Here, the larger the block classification unit size, the fewer the number of block filters used.

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

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

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

[0685] In addition, the filter information is entropy encoded / decoded to be arranged in the sequence parameter set, picture parameter set, slice header, slice data, parallel block header, parallel block group header, CTU, or CTB in the bitstream.

[0686] On the other hand, the filter information includes at least one piece of information selected from the following information: information on whether to perform luminance component filtering, information on whether to perform chrominance component filtering, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information on whether to perform filtering based on each slice, parallel block, parallel block group, picture, CTU, CTB, block, or CU, information on the number of times of performing CU-based filtering, CU maximum depth filtering information, information on whether to perform CU-based filtering, information on whether to use a filter of a previous reference picture, information on the filter index of the previous reference picture, information on whether to use information of a fixed filter for block classification index information, index information for the fixed filter, filter merge information, information on whether to use different filters for the luminance component and the chrominance component respectively, and filter symmetric shape information.

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

[0688] On the other hand, the filter information includes at most L luminance filters. Here, L is a positive integer and specifically 25. Additionally, the filter information includes at most L chrominance filters. Here, L is a positive integer and specifically 1.

[0689] On the other hand, one filter includes at most K luminance filter coefficients. Here, K is a positive integer and specifically 13. Additionally, the filter information includes at most K chrominance filter coefficients. Here, K is a positive integer and specifically 7.

[0690] For example, the information about the symmetric shape of the filter is information about a filter shape such as a point-symmetric shape, a horizontal-symmetric shape, a vertical-symmetric shape, or a combination of a point-symmetric shape, a horizontal-symmetric shape, and a vertical-symmetric shape.

[0691] On the other hand, only some of the filter coefficients in the filter coefficients are signaled. For example, when the filter is in a symmetric form, information about only one of the filter coefficient groups in the filter symmetric shape and the symmetric filter coefficient group is signaled. Optionally, for example, since the filter coefficient at the center of the filter can be implicitly derived, the filter coefficient at the center of the filter is not signaled.

[0692] According to an embodiment of the present invention, the filter coefficient values in the filter information are quantized in the encoder, and the resulting quantized filter coefficient values are entropy-coded. Similarly, the quantized filter coefficient values quantized 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 number of M bits, and then dequantized. Additionally, at least one filter coefficient is quantized to a different number of bits and dequantized. Conversely, at least one of the filter coefficients can be quantized to the same number of bits and dequantized. The M bits are determined according to the quantization parameter. Furthermore, M in the M bits is a constant predefined in the encoder and the decoder. Here, M can be a positive integer, specifically 8 or 10. The M bits can be less than or equal to the number of bits required to represent a sample in the encoder / decoder. For example, when the number of bits required to represent a sample is 10, then M can be 8. The first filter coefficient among the filter coefficients within the filter can be a value in the range from -2 M to 2 M -1, and the second filter coefficient can be a value from 0 to 2 MValues within the range of -1. Here, the first filter coefficient refers to the filter coefficients other than the central filter coefficient among the filter coefficients, and the second filter coefficient refers to the central filter coefficient among the filter coefficients.

[0693] The filter coefficient values in the filter information can be clipped by at least one of the encoder and the decoder, and at least one of the minimum value and the maximum value related to the clipping can be entropy-coded / decoded. The filter coefficient values can be clipped to fall within the range of the minimum value to the maximum value. For each filter coefficient, at least one of the minimum value and the maximum value can be a different value. On the other hand, for each filter coefficient, at least one of the minimum value and the maximum value can be the same value. At least one of the minimum value and the maximum value can be determined according to the quantization parameter. At least one of the minimum value and the maximum value can be a constant value predefined in the encoder and the decoder.

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

[0695] For example, the number of filters in the multiple filter information is determined according to the quantization parameter of the picture, slice, parallel block group, parallel block, CTU, CTB, or block. Specifically, when the quantization parameter is less than the threshold T, J filters are entropy-coded / decoded. When the quantization parameter is greater than the threshold R, H filters are entropy-coded / decoded. In other cases, G filters are entropy-coded / 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 entropy-coded.

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

[0697] For example, whether to perform filtering on at least one of the luminance component and the chrominance component is indicated by using filtering execution information (flags) based on each CTU, CTB, CU, or block. For example, when the filtering execution information is a first value, filtering is performed based on each CTB, and when the filtering execution information is a second value, filtering is not performed on the corresponding CTB. In this case, information on whether to perform filtering on each CTB can be entropy encoded / decoded. Optionally, for example, information on the maximum depth or minimum size of a CU (CU maximum depth filter information) can be additionally entropy encoded / decoded, and CU-based filtering execution information on the CU with the maximum depth or on the CU with the minimum size can be entropy encoded / decoded.

[0698] For example, when a block can be partitioned into smaller square sub-blocks and non-square sub-blocks according to the block structure, CU-based flags can be entropy encoded / decoded until the partition depth at which the block has a block structure that can be partitioned into smaller square sub-blocks. Additionally, CU-based flags can be entropy encoded / decoded until the partition depth at which the block has a block structure that can be partitioned into smaller non-square sub-blocks.

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

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

[0701] Further optionally, for example, it is determined whether to perform filtering on at least one of the luminance and chrominance components according to a picture, slice, parallel block group, or parallel block type. Information on whether to perform filtering on at least one of the luminance component and the chrominance component can be a flag based on each picture, slice, parallel block group, or parallel block.

[0702] According to an embodiment of the present invention, filter coefficients belonging to different block classifications can be combined to reduce the amount of filter coefficients to be entropy encoded / decoded. In this case, filter merge information on whether to merge the filter coefficients is entropy encoded / decoded.

[0703] In addition, in order to reduce the amount of filter coefficients to be entropy-encoded / decoded, the filter coefficients of a reference picture may 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 referred to as temporal filter coefficient prediction. For example, temporal filter coefficient prediction is used for inter-predicted pictures (B / P pictures, slices, parallel block groups, or parallel blocks). 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 picture is omitted. In this case, the previous reference picture filter index indicating which reference picture's filter coefficients are used is entropy-encoded / decoded.

[0704] For example, when temporal filter coefficient prediction is used, a filter bank candidate list is constructed. Before decoding a new sequence, the filter bank candidate list is empty. However, whenever a picture is decoded, the filter coefficients of the picture are added to the filter bank candidate list. When the number of filters in the filter bank candidate list reaches the maximum number G of filters, a new filter may replace the oldest filter in the decoding order. That is, the filter bank candidate list is updated in a first-in first-out (FIFO) manner. Here, G is a positive integer and is specifically 6. To prevent duplication of filters in the filter bank candidate list, the filter coefficients of pictures that do not use temporal filter coefficient prediction may be added to the filter bank candidate list.

[0705] Optionally, for example, when temporal filter coefficient prediction is used, a filter bank candidate list for multiple temporal layer indices is constructed to support temporal scalability. That is, a filter bank candidate list is constructed for each temporal layer. For example, the filter bank candidate list for a corresponding temporal layer includes the filter bank for decoding a picture, where the temporal layer index of the decoded picture is equal to or less than the temporal layer index of the previously decoded picture. In addition, after decoding each picture, the filter coefficients for the current picture are added to the filter bank candidate list having a temporal layer index equal to or greater than the temporal layer index of the current picture.

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

[0707] Although the temporal filter coefficient prediction cannot be used for intra-predicted pictures (I-pictures, slices, parallel groups of blocks or parallel blocks), at least one of up to 16 fixed filters within the filter bank can be used for filtering according to the block classification index. To signal from the encoder to the decoder information about whether to use the fixed filter bank, entropy coding / decoding is performed on the information about whether to use a fixed filter for each block classification index. When a fixed filter is used, entropy coding / decoding is also performed on the index information about the fixed filter. Even when a fixed filter is used for a specific block classification index, entropy coding / decoding is performed on the filter coefficients, and the reconstructed picture is filtered using the entropy-coded / decoded filter coefficients and the fixed filter coefficients.

[0708] In addition, the fixed filter bank is also used for inter-predicted pictures (B / P-pictures, slices, parallel groups of blocks or parallel blocks).

[0709] Alternatively, adaptive in-loop filtering can be performed using fixed filters without entropy coding / decoding of the filter coefficients. Here, the fixed filters can represent a filter bank predefined in the encoder and the decoder. In this case, the encoder and the decoder perform entropy coding / decoding on the fixed filter index information without entropy coding / decoding of the filter coefficients, where the fixed filter index information indicates which filter in the filter bank or which filter bank in the filter bank predefined in the encoder and the decoder is used. In this case, filtering is performed using fixed filters that differ in at least one of filter coefficient values, filter taps (i.e., the number of filter taps or filter length), and filter shape, based on at least one of block classification, block, CU, slice, parallel block, parallel group of blocks, and picture.

[0710] On the other hand, at least one filter within the fixed filter bank can be transformed in terms of filter taps and / or filter shape. For example, as Figure 38 shown, the coefficients in a 9×9 diamond filter are transformed into the coefficients in a 5×5 square filter. Specifically, the coefficients in a 9×9 diamond filter can be transformed into the coefficients in a 5×5 square filter.

[0711] For example, the sum of the filter coefficients corresponding to filter coefficient indices 0, 2, and 6 in the 9×9 diamond shape is assigned to filter coefficient index 2 in the 5×5 square shape.

[0712] Optionally, for example, the sum of the filter coefficients corresponding to filter coefficient indices 1 and 5 in the 9×9 diamond shape is assigned to filter coefficient index 1 in the 5×5 square shape.

[0713] Further optionally, for example, the sum of the filter coefficients corresponding to filter coefficient indices 3 and 7 in the 9×9 diamond shape is assigned to filter coefficient index 3 in the 5×5 square shape.

[0714] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 4 in the 9×9 diamond shape is assigned to filter coefficient index 0 in the 5×5 square shape.

[0715] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 8 in the 9×9 diamond shape is assigned to filter coefficient index 4 in the 5×5 square shape.

[0716] Further optionally, for example, the sum of the filter coefficients corresponding to filter coefficient indices 9 and 10 in the 9×9 diamond shape is assigned to filter coefficient index 5 in the 5×5 square shape.

[0717] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 11 in the 9×9 diamond shape is assigned to filter coefficient index 6 in the 5×5 square shape.

[0718] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 12 in the 9×9 diamond shape is assigned to filter coefficient index 7 in the 5×5 square shape.

[0719] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 13 in the 9×9 diamond shape is assigned to filter coefficient index 8 in the 5×5 square shape.

[0720] Further optionally, for example, the sum of the filter coefficients corresponding to filter coefficient indices 14 and 15 in the 9×9 diamond shape is assigned to filter coefficient index 9 in the 5×5 square shape.

[0721] Further optionally, for example, the sum of the filter coefficients corresponding to filter coefficient indices 16, 17, and 18 in the 9×9 diamond shape is assigned to filter coefficient index 10 in the 5×5 square shape.

[0722] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 19 in the 9×9 diamond shape is assigned to filter coefficient index 11 in the 5×5 square shape.

[0723] Further optionally, for example, the filter coefficient corresponding to filter coefficient index 20 in the 9×9 diamond shape is assigned to filter coefficient index 12 in the 5×5 square shape.

[0724] Table 2 shows an exemplary method of generating filter coefficients by transforming 9×9 diamond filter coefficients into 5×5 square filter coefficients.

[0725] [Table 2]

[0726]

[0727]

[0728]

[0729] In Table 2, the sum of at least one of the filter coefficients of the 9×9 diamond filter is equal to the sum of at least one of the filter coefficients of the corresponding 5×5 square filter.

[0730] On the other hand, when a maximum of 16 fixed filter groups are used for the 9×9 diamond filter coefficients, data of a maximum of 21 filter coefficients×25 filters×16 filter types need to be stored in the memory. When a maximum of 16 fixed filter groups are used for the filter coefficients of the 5×5 square filter, data of a maximum of 13 filter coefficients×25 filters×16 filter types need to be stored in the memory. Here, since the size of the memory required to store the fixed filter coefficients in the 5×5 square filter is smaller than the size of the memory required to store the fixed filter coefficients in the 9×9 diamond filter, the memory capacity requirement and the memory access bandwidth are reduced.

[0731] On the other hand, filtering may be performed on the reconstructed / decoded chrominance component using a filter obtained by transforming a filter for the co-located luminance component in terms of filter taps and / or filter shape.

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

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

[0734] According to an embodiment of the present invention, as a determination result of whether to perform block classification and / or filtering on a chrominance component, the determination result of whether to perform block classification and / or filtering on the corresponding luminance component is used as it is. In addition, as filter coefficients for the chrominance component, the filter coefficients that have been used for the corresponding luminance component are used. For example, a predetermined 5×5 diamond filter is used.

[0735] As an example, the filter coefficients in a 9×9 filter for the luminance component can be transformed into the filter coefficients in a 5×5 filter for the chrominance component. In this case, the outermost filter coefficients are set to zero.

[0736] As another example, when filter coefficients in the form of a 5×5 filter are used for the luminance component, the filter coefficients for the luminance component are the same as the filter coefficients for the chrominance component. That is, the filter coefficients for the luminance component can be used as the filter coefficients for the chrominance component as they are.

[0737] As another example, in order to maintain the shape of the 5×5 filter for filtering the chrominance component, the filter coefficients other than the 5×5 diamond filter are replaced by the coefficients at the boundary of the 5×5 diamond filter.

[0738] On the other hand, in-loop filtering for luminance blocks and in-loop filtering for chrominance blocks can be performed separately. A control flag is signaled at the picture, slice, parallel block group, parallel block, CTU, or CTB level to indicate whether adaptive in-loop filtering for the chrominance component is supported separately. A flag can be signaled to indicate a mode of jointly performing adaptive in-loop filtering for luminance blocks and chrominance blocks or a mode of separately performing adaptive in-loop filtering for luminance blocks and adaptive in-loop filtering for chrominance blocks.

[0739] According to an embodiment of the present invention, when entropy encoding / decoding at least one piece of filter information, at least one of the following binarization methods can be used:

[0740] Truncated Rice binarization method;

[0741] K-th order exponential Golomb binarization method;

[0742] Limited K-th order exponential Golomb binarization method;

[0743] Fixed-length binarization method;

[0744] Unary binarization method; and

[0745] Truncated unary binarization method.

[0746] As an example, different binarization methods for a luminance filter and a chrominance filter are used to perform entropy encoding / decoding on the filter coefficient values of the luminance filter and the filter coefficient values of the chrominance filter.

[0747] As another example, different binarization methods are used to perform entropy encoding / decoding on the filter coefficient values of a luminance filter. As another example, the same binarization method is used to perform entropy encoding / decoding on the filter coefficient values of a luminance filter.

[0748] As another example, different binarization methods are used to perform entropy encoding / decoding on the filter coefficient values of a chrominance filter. As another example, the same binarization method is used to perform entropy encoding / decoding on the filter coefficient values of a chrominance filter.

[0749] When performing entropy encoding / decoding on at least one piece of filter information, as an example, at least one piece of filter information of at least one neighboring block in a neighboring block, or at least one piece of previously encoded / decoded filter information, or encoded / decoded filter information within a previous picture is used to determine a context model.

[0750] As another example, when performing entropy encoding / decoding on at least one piece of filter information, at least one piece of filter information of different components is used to determine a context model.

[0751] As another example, when performing entropy encoding / decoding on filter coefficients, at least one of the filter coefficients in a filter is used to determine a context model.

[0752] As another example, when performing entropy encoding / decoding on at least one piece of filter information, at least one piece of filter information of at least one neighboring block in a neighboring block, or at least one piece of previously encoded / decoded filter information, or encoded / decoded filter information within a previous picture is used to determine a context model.

[0753] As another example, when performing entropy encoding / decoding on at least one piece of filter information, at least one piece of filter information of different components is used as a predicted value of the filter information to perform entropy encoding / decoding.

[0754] As another example, when performing entropy encoding / decoding on filter coefficients, at least one of the filter coefficients within a filter is used as a predicted value to perform entropy encoding / decoding.

[0755] As another example, any combination of filter information entropy encoding / decoding methods is used to perform entropy encoding / decoding on the filter information.

[0756] According to an embodiment of the present invention, adaptive in-loop filtering is performed in units of at least one of a block, a CU, a PU, a TU, a CB, a PB, a TB, a CTU, a CTB, a slice, a parallel block, a parallel block group, and a picture. When performing adaptive in-loop filtering on each of the above units, it means performing a block classification step, a filtering execution step, and a filter information encoding step in units of at least one of a block, a CU, a PU, a TU, a CB, a PB, a TB, a CTU, a CTB, a slice, a parallel block, a parallel block group, and a picture.

[0757] According to an embodiment of the present invention, it is determined whether to perform adaptive in-loop filtering based on a determination of whether to perform at least one of deblocking filtering, sample adaptive offset, and bi-directional filtering.

[0758] As an example, adaptive in-loop filtering is performed on the reconstructed / decoded samples in the current picture that have undergone at least one of deblocking filtering, sample adaptive offset, and bi-directional filtering.

[0759] As another example, adaptive in-loop filtering is not performed on the reconstructed / decoded samples in the current picture that have undergone at least one of deblocking filtering, sample adaptive offset, and bi-directional filtering.

[0760] As another example, for the reconstructed / decoded samples in the current picture that have undergone at least one of deblocking filtering, sample adaptive offset, and bi-directional filtering, adaptive in-loop filtering is performed on the reconstructed / decoded samples in the current picture using L filters without performing block classification. Here, L is a positive integer.

[0761] According to an embodiment of the present invention, it is determined whether to perform adaptive in-loop filtering according to the slice or parallel block group type of the current picture.

[0762] As an example, adaptive in-loop filtering is performed only when the slice or parallel block group type of the current picture is an I slice or an I parallel block group.

[0763] As another example, adaptive in-loop filtering is performed when the slice or parallel block group type of the current picture is at least one of an I slice, a B slice, a P slice, an I parallel block group, a B parallel block group, and a P parallel block group.

[0764] As an example, when the slice or parallel block group type of the current picture is at least one of an I slice, a B slice, a P slice, an I parallel block group, a B parallel block group, and a P parallel block group, when performing adaptive in-loop filtering on the current picture, adaptive in-loop filtering is performed on the reconstructed / decoded samples in the current picture using L filters without performing block classification. Here, L is a positive integer.

[0765] As another example, when the stripe or parallel block group type of the current picture is at least one of an I stripe, a B stripe, a P stripe, an I parallel block group, a B parallel block group, and a P parallel block group, an adaptive in-loop filtering is performed using one filter shape.

[0766] As another example, when the stripe or parallel block group type of the current picture is at least one of an I stripe, a B stripe, a P stripe, an I parallel block group, a B parallel block group, and a P parallel block group, an adaptive in-loop filtering is performed using one filter tap.

[0767] As another example, when the stripe or parallel block group type of the current picture is at least one of an I stripe, a B stripe, a P stripe, an I parallel block group, a B parallel block group, and a P parallel block group, at least one of block classification and adaptive in-loop filtering is performed based on each block of M×N size. In this case, both M and N are positive integers. Specifically, both M and N are 4.

[0768] According to an embodiment of the present invention, it is determined whether to perform adaptive in-loop filtering according to the determination of whether the current picture is used as a reference picture.

[0769] For example, when the current picture is used as a reference picture during the process of encoding / decoding a subsequent picture, an adaptive in-loop filtering is performed on the current picture.

[0770] As another example, when the current picture is not used as a reference picture during the process of encoding / decoding a subsequent picture, an adaptive in-loop filtering is not performed on the current picture.

[0771] As another example, when the current picture is not used during the process of a subsequent picture, when performing an adaptive in-loop filtering on the current picture, L filters are used to perform an adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification. Here, L is a positive integer.

[0772] As another example, when the current picture is not used during the process of encoding / decoding a subsequent picture, an adaptive in-loop filtering is performed using one filter shape.

[0773] As another example, when the current image is not used during the process of encoding / decoding a subsequent picture, an adaptive in-loop filtering is performed using one filter tap.

[0774] As another example, when the current picture is not used during the process of encoding / decoding a subsequent picture, at least one of block classification and filtering is performed based on each block of N×M size. In this case, both M and N are positive integers. Specifically, both M and N are 4.

[0775] According to an embodiment of the present invention, it is determined whether to perform adaptive in-loop filtering according to the time layer identifier.

[0776] As an example, when the time layer identifier of the current picture is 0 representing the bottom layer, adaptive in-loop filtering is performed on the current picture.

[0777] As another example, when the time layer identifier of the current picture is 4 representing the top layer, adaptive in-loop filtering is performed.

[0778] As another example, when the time layer identifier of the current picture is 4 representing the top layer, when performing adaptive in-loop filtering on the current picture, L filters are used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification. Here, L is a positive integer.

[0779] As another example, when the time layer identifier of the current picture is 4 representing the top layer, adaptive in-loop filtering is performed using one filter shape.

[0780] As another example, when the time layer identifier of the current picture is 4 representing the top layer, one filter tap is used to perform adaptive in-loop filtering.

[0781] As another example, when the time layer identifier of the current picture is 4 representing the top layer, at least one of block classification and adaptive in-loop filtering is performed based on each N×M-sized block. In this case, both M and N are positive integers. Specifically, both M and N are 4.

[0782] According to an embodiment of the present invention, at least one of the block classification methods is performed according to the time layer identifier.

[0783] For example, when the time layer identifier of the current picture is 0 representing the bottom layer, at least one of the block classification methods described above is performed on the current picture.

[0784] Optionally, when the time layer identifier of the current picture is 4 representing the top layer, at least one of the above block classification methods is performed on the current picture.

[0785] According to an embodiment of the present invention, at least one of the above block classification methods is performed according to the value of the time layer identifier.

[0786] As another example, when the time layer identifier of the current picture is 4 representing the top layer, when performing adaptive in-loop filtering on the current picture, L filters are used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification. Here, L is a positive integer.

[0787] As another example, when the time layer identifier of the current picture is 4 representing the top layer, adaptive in-loop filtering is performed using one filter shape.

[0788] As another example, when the time layer identifier of the current picture is 4 which represents the top layer, an adaptive in-loop filtering is performed using one filter tap.

[0789] As another example, when the time layer identifier of the current picture is 4 which represents the top layer, at least one of block classification and adaptive in-loop filtering is performed based on each block of N×M size. In this case, both M and N are positive integers. Specifically, both M and N are 4.

[0790] As another example, when performing adaptive in-loop filtering on the current picture, L filters are used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification. Here, L is a positive integer. Optionally, in this case, L filters are used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification, and it is also independent of the time layer identifier.

[0791] On the other hand, when performing adaptive in-loop filtering on the current picture, L filters are used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture regardless of whether block classification is performed. Here, L is a positive integer. In this case, L filters can be used to perform adaptive in-loop filtering on the reconstructed / decoded samples in the current picture without performing block classification, and it is also independent of the time layer identifier and whether block classification is performed.

[0792] On the other hand, an adaptive in-loop filtering can be performed using one filter shape. In this case, an adaptive in-loop filtering can be performed on the reconstructed / decoded samples in the current image using one filter shape without performing block classification. Optionally, an adaptive in-loop filtering can be performed on the reconstructed / decoded samples in the current image using one filter shape regardless of whether block classification is performed.

[0793] On the other hand, an adaptive in-loop filtering can be performed using one filter tap. In this case, an adaptive in-loop filtering can be performed on the reconstructed / decoded samples in the current image using one filter tap without performing block classification. Optionally, an adaptive in-loop filtering can be performed on the reconstructed / decoded samples in the current image using one filter tap regardless of whether block classification is performed.

[0794] On the other hand, adaptive in-loop filtering can be performed based on a specific unit. For example, the specific unit can be at least one of a picture, a slice, a parallel block, a parallel block group, a CTU, a CTB, a CU, a PU, a TU, a CB, a PB, a TB, and a block of M×N size. Here, both M and N are positive integers. M and N are the same integer or different integers. In addition, M, N, or both M and N are values predefined in the encoder / decoder. Optionally, M, N, or both M and N can be values signaled from the encoder to the decoder.

[0795] Figures 39 to 5 5 is a diagram showing an exemplary method of determining the sum of gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction based on subsampling.

[0796] Referring to Figures 39 to 5 5, filtering is performed based on each 4×4-sized luminance block. In this case, different filter coefficients can be used for each 4×4-sized luminance block to perform filtering. Subsampled Laplacian operations can be performed to classify 4×4-sized luminance blocks. In addition, the filter coefficients for filtering vary for each 4×4-sized luminance block. Additionally, the 4×4-sized luminance blocks are classified into up to 25 classifications. Further, a classification index corresponding to the filter index of the 4×4-sized luminance block can be derived based on the directional value and / or quantization activity value of the block. Here, to calculate the directional value and / or quantization activity value for each 4×4-sized luminance block, the sum of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction is calculated by adding the results of one-dimensional Laplacian operations calculated at the subsampled positions within an 8×8-sized block.

[0797] Specifically, referring to Figure 39 , in the case of block classification based on each 4×4-sized block, the sum of the gradient values g v , g h , g d1 and g d2 for at least one of the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction (hereinafter referred to as "the first method") is calculated based on subsampling. Here, V, H, D1, and D2 respectively represent the results of sample-based one-dimensional Laplacian operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are performed along the horizontal direction, vertical direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2 respectively. Additionally, the positions where the one-dimensional Laplacian operations are performed can be the subsampled positions. In Figure 39Among them, a block classification index C is assigned based on each block of 4×4 size (i.e., the shaded area). 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-line rectangle represents the reconstructed sample point position, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0798] Here, Figures 40a to 40d An exemplary block classification-based encoding / decoding process using the first method is shown. Figures 41a to 41d Another exemplary block classification-based encoding / decoding process using the first method is shown one-dimensionally. Figures 42a to 42d Another exemplary block classification-based encoding / decoding process using the first method is shown two-dimensionally.

[0799] Referring to Figure 43 , in the case of block classification based on each block of 4×4 size, the sum g of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction is calculated based on subsampling v 、g h 、g d1 and g d2 of at least one (hereinafter referred to as the "second method"). Here, V, H, D1, and D2 respectively represent the results of one-dimensional Laplacian operations based on samples for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, one-dimensional Laplacian operations are respectively performed in the horizontal direction, vertical direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions where the one-dimensional Laplacian operations are performed can be the subsampled positions. In Figure 43 , a block classification index C is assigned based on each block of 4×4 size (i.e., the shaded area). 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-line rectangle represents the reconstructed sample point position, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0800] Specifically, the second method means that when both the coordinate x value and the coordinate y value are even, or when both the coordinate x value and the coordinate y value are odd, a one-dimensional Laplacian operation is performed at the position (x, y). When both the coordinate x value and the coordinate y value are not even, or both the coordinate x value and the coordinate y value are not odd, the result of the one-dimensional Laplacian operation at the position (x, y) is assigned zero. That is, it means performing the one-dimensional Laplacian operation in a checkerboard pattern according to the coordinate x value and the coordinate y value.

[0801] Referring to Figure 43The positions for performing one-dimensional Laplacian operations in the horizontal direction, vertical direction, first diagonal direction, and second diagonal direction are the same. That is, regardless of the direction of the vertical, horizontal, first diagonal, and second diagonal directions, the one-dimensional Laplacian operation positions with unified subsampling are used to perform the one-dimensional Laplacian operations for each direction.

[0802] Here, Figures 44a to 44d An exemplary block classification-based encoding / decoding process using the second method is shown. Figures 45a to 45d Another exemplary block classification-based encoding / decoding process using the second method is shown. Figures 46a to 46d Another exemplary block classification-based encoding / decoding process using the first method is shown. Figures 47a to 47d Another exemplary block classification-based encoding / decoding process using the first method is shown.

[0803] Referring to Figure 48 , in the case of performing block classification based on each 4×4-sized block, the sum g of the gradient values for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction is calculated based on subsampling v , g h , g d1 , and g d2 of at least one (hereinafter referred to as the "third method"). Here, V, H, D1, and D2 respectively represent the results of the one-dimensional Laplacian operations based on samples for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction. That is, the one-dimensional Laplacian operations are respectively performed in the horizontal direction, vertical direction, first diagonal direction, and second diagonal direction at positions V, H, D1, and D2. Additionally, the positions for performing the one-dimensional Laplacian operations can be the subsampled positions. In Figure 48 , the block classification index C is assigned based on each 4×4-sized block (i.e., the shaded area). 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-line rectangle represents the reconstructed sample position, and the thick solid-line rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

[0804] Specifically, the third method means that when either the coordinate x value or the coordinate y value is even and the other is odd, the one-dimensional Laplacian operation is performed at the position (x,y). When both the coordinate x value and the coordinate y value are even or odd, the result of the one-dimensional Laplacian operation at the position (x,y) is assigned zero. That is, it means performing the one-dimensional Laplacian operation in a checkerboard pattern according to the coordinate x value and the coordinate y value.

[0805] Referring to Figure 48, the positions for performing one-dimensional Laplacian operations in the horizontal direction, vertical direction, first diagonal direction, and...

Claims

1. A video decoding method, comprising: decoding filter information; classifying a block classification unit into classes; assigning a block classification index to the block classification unit; and applying filtering to samples of the block classification unit by using the filter information and the block classification index, and wherein the block classification index is determined according to directionality information and activity information, wherein at least one of the directionality information and the activity information is determined based on gradient values for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction, wherein the gradient values are obtained by using a Laplacian operation on the block classification unit, wherein the Laplacian operation is performed only on specific samples included in the block classification unit, wherein horizontal and vertical positions of the specific samples are both even positions or both odd positions based on the block classification unit, wherein the Laplacian operation is a one-dimensional Laplacian operation, and wherein the block classification unit is included in a coding tree block.

2. A video encoding method, comprising: classifying a block classification unit into classes; assigning a block classification index to the block classification unit; applying filtering to samples of the block classification unit by using filter information and the block classification index; and encoding the filter information, and wherein the block classification index is determined according to directionality information and activity information, wherein at least one of the directionality information and the activity information is determined based on gradient values for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction, wherein the gradient values are obtained by using a Laplacian operation on the block classification unit, wherein the Laplacian operation is performed only on specific samples included in the block classification unit, wherein horizontal and vertical positions of the specific samples are both even positions or both odd positions based on the block classification unit, wherein the Laplacian operation is a one-dimensional Laplacian operation, and wherein the block classification unit is included in a coding tree block.

3. A method for transmitting a bitstream generated by an image encoding method, the method comprising: classifying a block classification unit into classes; assigning a block classification index to the block classification unit; applying filtering to samples of the block classification unit by using filter information and the block classification index; and encoding the filter information, and wherein the block classification index is determined according to directionality information and activity information, wherein at least one of the directionality information and the activity information is determined based on gradient values for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction, wherein the gradient values are obtained by using a Laplacian operation on the block classification unit, wherein the Laplacian operation is performed only on specific samples included in the block classification unit, Among them, the horizontal position and the vertical position of the specific sample point are both even positions or both odd positions based on the block classification unit. Among them, the Laplacian operation is a one-dimensional Laplacian operation, and Among them, the block classification unit is included in the coding tree block.

Citation Information

Patent Citations

  • Video coding and decoding methods and video coding and decoding devices using adaptive loop filtering

    CN102474615A

  • Video encoding method using in-loop filter parameter prediction and apparatus therefor, and video decoding method and apparatus therefor

    CN106716997A