Image encoding device and method, image decoding device, and method

Bidirectional filtering in-loop improves image quality and reduces bit rate by addressing blocking artifacts and data requirements in video encoding and decoding.

WO2026101258A1PCT designated stage Publication Date: 2026-05-15SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SAMSUNG ELECTRONICS CO LTD
Filing Date
2025-11-06
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies suffer from issues such as blocking artifacts, quantization-induced staircasing, and ringing noise, which degrade the subjective and objective image quality, and require significant data for signaling and higher bit rates.

Method used

Implementing bidirectional filtering within in-loop filtering processes that determine parameters based on prediction mode, block size, quantization parameter, and MAD information to improve image quality and reduce data requirements.

Benefits of technology

Enhances image quality by reducing artifacts and bit rate while improving compression and prediction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2025018126_15052026_PF_FP_ABST
    Figure KR2025018126_15052026_PF_FP_ABST
Patent Text Reader

Abstract

An image decoding method may be provided in one embodiment of the present disclosure. The image decoding method may comprise the steps of: determining to perform bilateral filtering on the current block on the basis of information on whether to perform the bilateral filtering in in-loop filtering acquired from a bitstream; determining a parameter to be applied to the difference between a first sample value corresponding to a first sample included in the current block, and a second sample value corresponding to a second sample which is one of neighboring samples of the first sample, on the basis of at least one among a prediction mode of the current block, the size of a prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block; determining an offset for the bilateral filtering by applying the parameter to the difference between the first sample value and the second sample value; and obtaining a bilateral-filtered block by applying the offset to the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Device and method for encoding an image, device and method for decoding an image

[0001] The present disclosure relates to the field of image encoding and decoding, and specifically, to an apparatus and method for encoding or decoding an image by performing bidirectional filtering within in-loop filtering.

[0002] In the field of video encoding and decoding, various filtering techniques can be utilized to efficiently encode and decode original video. In block-based encoding and decoding processes, side effects such as blocking artifacts, quantization-induced staircasing, and ringing noise may occur. To mitigate these issues and improve the subjective and objective image quality of the decoded video, the latest codec technologies apply in-loop filtering techniques.

[0003] In-loop filtering is a filtering technique applied to the restored image signal during the image encoding and decoding process, designed to minimize encoding loss and improve prediction efficiency. As in-loop filtering, the image encoding device and image decoder can perform deblocking filtering, sample adaptive offset filtering, bilateral filtering, adaptive loop filtering, etc.

[0004] An image encoding method and apparatus and an image decoding method and apparatus according to one embodiment have the objective of improving the performance of predictive encoding and predictive decoding for a current block.

[0005] An image encoding method and apparatus and an image decoding method and apparatus according to one embodiment have the objective of reducing the amount of data required for signaling in an intra-prediction mode or an inter-prediction mode.

[0006] An image encoding method and apparatus and an image decoding method and apparatus according to one embodiment have the objective of reducing the bit rate of a bitstream.

[0007] An image encoding method and apparatus and an image decoding method and apparatus according to one embodiment have the objective of improving image quality by making the decoded image closer to the original image.

[0008] The technical problems to be solved by the present disclosure are not limited to those mentioned above, and other unmentioned technical problems will be clearly understood by those skilled in the art to which the present disclosure belongs from the description below.

[0009] In one embodiment of the present disclosure, an image decoding method may be provided. The image decoding method may include a step of determining to perform bilateral filtering on the current block based on information regarding whether to perform bilateral filtering within in-loop filtering obtained from a bitstream. The image decoding method may include a step of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the Mean Absolute Difference (MAD) information of the prediction block. The image decoding method may include a step of determining an offset for bilateral filtering by applying the parameter to the difference between the first sample value and the second sample value. The image decoding method may include a step of obtaining a bilaterally filtered block by applying the offset to the current block.

[0010] In one embodiment of the present disclosure, an image decoding device may be provided. The image decoding device may include at least one memory storing at least one instruction; and at least one processor operating according to at least one instruction. The at least one processor may determine to perform bidirectional filtering on a current block based on information regarding whether to perform bidirectional filtering within in-loop filtering obtained from a bitstream, and determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of a prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block, and determine an offset for bidirectional filtering based on the parameter to apply to the difference between the first sample value and the second sample value, and apply the offset to the current block to obtain a bidirectionally filtered block.

[0011] In one embodiment of the present disclosure, an image encoding method may be provided. The image encoding method may include a step of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of the prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block. The image encoding method may include a step of determining an offset for bidirectional filtering within in-loop filtering by applying the parameter to the difference between the first sample value and the second sample value. The image encoding method may include a step of determining whether to perform bidirectional filtering by applying the offset to the current block. The image encoding method may include a step of generating a bitstream containing information regarding whether to perform bidirectional filtering.

[0012] In one embodiment of the present disclosure, an image encoding device may be provided. The image encoding device may include at least one memory storing at least one instruction; and at least one processor operating according to at least one instruction. The at least one processor may determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of the prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block; determine an offset for bidirectional filtering within in-loop filtering by applying the parameter to the difference between the first sample value and the second sample value; determine whether to perform bidirectional filtering by applying the offset to the current block; and generate a bitstream including information regarding whether to perform bidirectional filtering.

[0013] In one embodiment of the present disclosure, a computer-readable recording medium may be provided for storing a bitstream generated by an image encoding method. The bitstream may include information regarding whether to perform bidirectional filtering within in-loop filtering. The information regarding whether to perform bidirectional filtering may be determined by obtaining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of the prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block, and by using an offset for bidirectional filtering determined by applying the parameter to the difference between the first sample value and the second sample value.

[0014] According to one embodiment of the present disclosure, in the process of decoding and encoding an image, the compression performance of the image can be improved, the prediction performance can be improved, and the decoding quality of the image can be improved.

[0015] FIG. 1 is a block diagram of an image decoding device according to one embodiment.

[0016] FIG. 2 is a block diagram of an image encoding device according to one embodiment.

[0017] FIG. 3 illustrates a process of determining at least one encoding unit by dividing the current encoding unit according to one embodiment.

[0018] FIG. 4 illustrates a process of determining at least one encoding unit by dividing a encoding unit that is in the shape of a non-square according to one embodiment.

[0019] FIG. 5 illustrates a process of dividing a encoding unit based on at least one of block shape information and division shape mode information according to one embodiment.

[0020] FIG. 6 illustrates a method for determining a predetermined encoding unit among an odd number of encoding units according to one embodiment.

[0021] FIG. 7 illustrates the order in which a plurality of encoding units are processed when a current encoding unit is divided to determine a plurality of encoding units according to one embodiment.

[0022] FIG. 8 illustrates a process for determining that, according to one embodiment, when the encoding unit cannot be processed in a predetermined order, the current encoding unit is divided into an odd number of encoding units.

[0023] FIG. 9 illustrates a process of determining at least one encoding unit by dividing a first encoding unit according to one embodiment.

[0024] FIG. 10 illustrates that, according to one embodiment, the shape that can be divided is limited when a second encoding unit of a non-square shape determined by dividing a first encoding unit satisfies a predetermined condition.

[0025] FIG. 11 illustrates a process of dividing square-shaped encoding units when, according to one embodiment, the divided shape mode information cannot represent division into four square-shaped encoding units.

[0026] FIG. 12 illustrates that, according to one embodiment, the processing order between a plurality of encoding units may vary depending on the division process of the encoding unit.

[0027] FIG. 13 illustrates a process in which, according to one embodiment, a encoding unit is recursively divided to determine a plurality of encoding units, and the depth of the encoding unit is determined as the shape and size of the encoding unit change.

[0028] FIG. 14 illustrates a depth and part index (hereinafter PID) for distinguishing between coding units that can be determined according to the shape and size of the coding units according to one embodiment.

[0029] FIG. 15 illustrates that a plurality of encoding units are determined according to a plurality of predetermined data units included in a picture according to one embodiment.

[0030] FIG. 16 illustrates the encoding units that can be determined for each picture when the combination of forms in which the encoding units can be divided according to one embodiment is different for each picture.

[0031] FIG. 17 illustrates various forms of encoding units that can be determined based on partitioned form mode information expressed as binary code according to one embodiment.

[0032] FIG. 18 illustrates another form of encoding unit that can be determined based on partitioned form mode information represented by binary code according to one embodiment.

[0033] FIG. 19 is a block diagram of an image encoding and decoding system that performs in-loop filtering according to one embodiment.

[0034] FIG. 20 is a block diagram illustrating the configuration of an image decoding device according to one embodiment.

[0035] FIG. 21 is a block diagram showing the configuration of an in-loop filtering unit according to one embodiment of the present disclosure.

[0036] FIG. 22 is a drawing for explaining the shape of a bidirectional filter according to one embodiment of the present disclosure.

[0037] FIG. 23 is a drawing showing a graph for determining an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0038] FIG. 24 is a drawing showing a graph used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0039] FIG. 25 is a graph showing a graph used to determine an offset for bidirectional filtering of a luma component according to one embodiment of the present disclosure.

[0040] FIG. 26 is a graph showing a graph used to determine an offset for bidirectional filtering of chroma components according to one embodiment of the present disclosure.

[0041] FIG. 27 is a drawing showing a graph used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0042] FIG. 28 is a diagram showing an example of determining parameters used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0043] FIG. 29 is a flowchart of an image decoding method according to one embodiment.

[0044] FIG. 30 is a block diagram illustrating the configuration of an image encoding device according to one embodiment.

[0045] FIG. 31 is a flowchart of an image encoding method according to one embodiment.

[0046] The present disclosure is capable of various modifications and may have various embodiments, and embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the embodiments of the present disclosure, and the present disclosure may include all modifications, equivalents, and substitutions that fall within the spirit and technical scope of the various embodiments.

[0047] In describing the embodiments, if it is determined that a detailed description of related prior art could unnecessarily obscure the gist of the present disclosure, such detailed description may be omitted. Additionally, numbers used in the description of the embodiments (e.g., first, second, etc.) may correspond to identification symbols to distinguish one component from another.

[0048] In the present disclosure, the expression “at least one of a, b, or c” may refer to “a”, “b”, “c”, “a and b”, “a and c”, “b and c”, “a, b, and c all”, or variations thereof.

[0049] In the present disclosure, when one component is described as being "connected" or "connected" to another component, the one component may be directly connected to or directly connected to another component, but unless specifically stated otherwise, it may be connected or connected through another component in between.

[0050] In this disclosure, components expressed as ‘~part (unit)’, ‘module’, etc. may consist of two or more components combined into a single component, or a single component may be divided into two or more more subdivided components. Additionally, each component described below may additionally perform some or all of the functions of other components in addition to the primary function it is responsible for, and some of the primary functions of each component may be exclusively performed by other components.

[0051] In the present disclosure, 'image' may refer to a picture, a still image, a frame, a video composed of a plurality of consecutive still images, or a video.

[0052] In the present disclosure, 'sample' may refer to data assigned to a sampling location of an image that is subject to processing. For example, a pixel within a frame in a spatial domain may correspond to a sample. A unit comprising a plurality of samples may be defined as a block.

[0053] Hereinafter, with reference to FIGS. 1 to 19, an image encoding method and apparatus based on a tree structure encoding unit and a conversion unit according to one embodiment, an image decoding method and apparatus are disclosed.

[0054] FIG. 1 illustrates a block diagram of an image decoding device (100) according to one embodiment.

[0055] The video decoding device (100) may include a bitstream acquisition unit (110) and a decoding unit (120). The bitstream acquisition unit (110) and the decoding unit (120) may include at least one processor. Additionally, the bitstream acquisition unit (110) and the decoding unit (120) may include a memory that stores instructions to be executed by at least one processor.

[0056] The bitstream acquisition unit (110) can receive a bitstream. The bitstream contains information in which an image is encoded by an image encoding device (200) described later. Additionally, the bitstream can be transmitted from the image encoding device (200). The image encoding device (200) and the image decoding device (100) can be connected via wired or wireless connection, and the bitstream acquisition unit (110) can receive the bitstream via wired or wireless connection. The bitstream acquisition unit (110) can receive the bitstream from a storage medium such as an optical medium or a hard disk. The decoding unit (120) can restore the image based on information obtained from the received bitstream. The decoding unit (120) can obtain syntax elements for restoring the image from the bitstream. The decoding unit (120) can restore the image based on the syntax elements.

[0057] To explain in detail the operation of the video decoding device (100), the bitstream acquisition unit (110) can receive a bitstream.

[0058] The image decoder (100) can perform an operation of obtaining an empty string corresponding to a partitioning mode of the encoding unit from a bitstream. The image decoder (100) can also perform an operation of determining a partitioning rule for the encoding unit. Additionally, the image decoder (100) can perform an operation of partitioning the encoding unit into a plurality of encoding units based on at least one of the empty string corresponding to the partitioning mode and the partitioning rule. To determine the partitioning rule, the image decoder (100) can determine an allowable first range of the size of the encoding unit according to the ratio of the width and height of the encoding unit. To determine the partitioning rule, the image decoder (100) can determine an allowable second range of the size of the encoding unit according to the partitioning mode of the encoding unit.

[0059] In the following, the division of a encoding unit according to one embodiment of the present disclosure will be described in detail.

[0060] First, a picture may be divided into one or more slices or one or more tiles. A slice or a tile may be a sequence of one or more Coding Tree Units (CTUs). Depending on the embodiment, a slice may include one or more tiles, and a slice may include one or more Coding Tree Units. A slice containing one or more tiles may be determined within the picture.

[0061] In contrast to the Max Coding Unit (CTU), there is the Max Coding Tree Block (CTB). A Max Coding Tree Block (CTB) refers to an NxN block containing NxN samples (where N is an integer). Each color component can be divided into one or more Max Coding Tree Blocks.

[0062] When a picture has three sample arrays (sample arrays for Y, Cr, and Cb components), the maximum encoding unit (CTU) is a unit comprising a maximum encoding block for luminance samples and two corresponding maximum encoding blocks for chroma samples, and syntax structures used to encode the luminance samples and chroma samples. When a picture is a monochrome picture, the maximum encoding unit is a unit comprising a maximum encoding block for monochrome samples and syntax structures used to encode the monochrome samples. When a picture is encoded in color planes separated by color components, the maximum encoding unit is a unit comprising the picture and syntax structures used to encode the samples of the picture.

[0063] A single maximum coding block (CTB) can be divided into MxN coding blocks containing MxN samples (M and N are integers).

[0064] When a picture has sample arrays for Y, Cr, and Cb components, a coding unit (CU) is a unit comprising a coding block for luminance samples and two coding blocks for corresponding chroma samples, and syntax structures used to encode the luminance samples and chroma samples. When a picture is a monochrome picture, a coding unit is a unit comprising a coding block for monochrome samples and syntax structures used to encode the monochrome samples. When a picture is a picture encoded in color planes separated by color components, a coding unit is a unit comprising the picture and syntax structures used to encode the samples of the picture.

[0065] As explained above, the maximum encoding block and the maximum encoding unit are distinct concepts, and the encoding block and the encoding unit are distinct concepts. That is, the (maximum) encoding unit refers to a data structure that includes the (maximum) encoding block containing the corresponding sample and the corresponding syntax structure. However, since a person skilled in the art can understand that the (maximum) encoding unit or the (maximum) encoding block refers to a block of a predetermined size containing a predetermined number of samples, the maximum encoding block and the maximum encoding unit, or the encoding block and the encoding unit, are referred to without distinction in the following specification unless there are special circumstances.

[0066] The image can be divided into Coding Tree Units (CTUs). The size of the CTU can be determined based on information obtained from the bitstream. The shape of the CTU can be a square of equal size, but it is not limited to this.

[0067] For example, information about the maximum size of a luma-encoded block can be obtained from a bitstream. For example, the maximum size of a luma-encoded block indicated by the information about the maximum size of a luma-encoded block may be one of 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, or 256x256.

[0068] For example, information regarding the maximum size of a two-divisionable luminance coding block and the difference in luminance block size can be obtained from a bitstream. The information regarding the difference in luminance block size may represent the size difference between the maximum luminance coding unit and the maximum two-divisionable luminance coding block. Therefore, by combining the information regarding the maximum size of the two-divisionable luminance coding block obtained from the bitstream with the information regarding the difference in luminance block size, the size of the maximum luminance coding unit can be determined. Using the size of the maximum luminance coding unit, the size of the maximum chroma coding unit can also be determined. For example, if the Y:Cb:Cr ratio according to the color format is 4:2:0, the size of the chroma block may be half the size of the luminance block, and similarly, the size of the maximum chroma coding unit may be half the size of the maximum luminance coding unit.

[0069] According to one embodiment, information regarding the maximum size of a binary splittable luminous encoding block is obtained from a bitstream, so the maximum size of the binary splittable luminous encoding block can be determined variably. Alternatively, the maximum size of a ternary splittable luminous encoding block can be fixed. For example, the maximum size of a ternary splittable luminous encoding block in picture I may be 32x32, and the maximum size of a ternary splittable luminous encoding block in picture P or picture B may be 64x64.

[0070] Additionally, the maximum encoding unit can be hierarchically divided into encoding units based on splitting mode information obtained from the bitstream. As splitting mode information, at least one of information indicating whether it is a quad split, information indicating whether it is a multi-split, splitting direction information, and splitting type information can be obtained from the bitstream.

[0071] For example, information indicating whether quad splitting is performed can indicate whether the current encoding unit will be quad split or not.

[0072] If the current encoding unit is not quad-splitting, information indicating multi-splitting can indicate whether the current encoding unit will no longer be split (NO_SPLIT) or whether it will be binary / ternary split.

[0073] If the current encoding unit is binary or binary split, the splitting direction information indicates that the current encoding unit is split in either the horizontal or vertical direction.

[0074] If the current encoding unit is split horizontally or vertically, the split type information indicates that the current encoding unit is split into binary or binary splits.

[0075] The splitting mode of the current encoding unit can be determined based on the splitting direction information and the splitting type information. The splitting mode when the current encoding unit is binary split in the horizontal direction can be determined as binary horizontal splitting (SPLIT_BT_HOR), when it is territorial split in the horizontal direction as territorial horizontal splitting (SPLIT_TT_HOR), when it is binary split in the vertical direction as binary vertical splitting (SPLIT_BT_VER), and when it is territorial split in the vertical direction as territorial vertical splitting (SPLIT_TT_VER).

[0076] The image decoding device (100) can obtain splitting mode information from a bitstream from a single empty string. The form of the bitstream received by the image decoding device (100) may include a fixed-length binary code, a unary code, a truncated unary code, a predetermined binary code, etc. The empty string represents information as a sequence of binary numbers. The empty string may consist of at least one bit. The image decoding device (100) can obtain splitting mode information corresponding to the empty string based on a splitting rule. Based on the single empty string, the image decoding device (100) can determine whether to quad split the encoding unit, whether not to split it, or the splitting direction and splitting type.

[0077] A coding unit may be smaller than or equal to a maximum coding unit. For example, since the maximum coding unit is a coding unit having the maximum size, it is also a coding unit. If the segmentation mode information for the maximum coding unit indicates that it is not segmented, the coding unit determined from the maximum coding unit has the same size as the maximum coding unit. If the segmentation mode information for the maximum coding unit indicates that it is segmented, the maximum coding unit may be segmented into coding units. Additionally, if the segmentation mode information for a coding unit indicates segmentation, the coding units may be segmented into coding units of smaller size. However, the segmentation of the image is not limited to this, and the maximum coding unit and the coding unit may not be distinguished. The segmentation of coding units is explained in more detail in FIGS. 3 through 16.

[0078] Additionally, one or more prediction blocks for prediction may be determined from the coding unit. The prediction blocks may be equal to or smaller than the coding unit. Additionally, one or more transformation blocks for transformation may be determined from the coding unit. The transformation blocks may be equal to or smaller than the coding unit.

[0079] The shape and size of the transformation block and the prediction block may not be related to each other.

[0080] In another embodiment, prediction can be performed using the encoding unit as a prediction block. Additionally, conversion can be performed using the encoding unit as a conversion block.

[0081] The division of the encoding unit is described in more detail in FIGS. 3 through 16. The current block and surrounding block of the present disclosure may represent one of the maximum encoding unit, the encoding unit, the prediction block, and the transformation block. Additionally, the current block or the current encoding unit is a block currently undergoing decoding or encoding, or a block currently undergoing division. The surrounding block may be a block restored prior to the current block. The surrounding block may be spatially or temporally adjacent to the current block. The surrounding block may be located on one of the lower-left, left, upper-left, upper, upper-right, right, or lower-right sides of the current block.

[0082] FIG. 3 illustrates a process in which an image decoding device (100) divides a current encoding unit to determine at least one encoding unit according to one embodiment.

[0083] The block shape may include 4Nx4N, 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN, or Nx8N. Here, N may be a positive integer. Block shape information is information indicating at least one of the shape, orientation, width, and height ratio or size of the encoding unit.

[0084] The shape of the encoding unit may include square and non-square. When the width and height of the encoding unit are the same (i.e., when the block shape of the encoding unit is 4Nx4N), the image decoder (100) may determine the block shape information of the encoding unit as square. The image decoder (100) may determine the shape of the encoding unit as non-square.

[0085] When the width and height of the encoding unit are different (i.e., when the block shape of the encoding unit is 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN, or Nx8N), the image decoder (100) can determine the block shape information of the encoding unit as non-square. When the shape of the encoding unit is non-square, the image decoder (100) can determine the ratio of the width and height among the block shape information of the encoding unit as at least one of 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 1:32, or 32:1. Additionally, based on the width and height of the encoding unit, the image decoding device (100) can determine whether the encoding unit is in a horizontal direction or a vertical direction. Additionally, based on at least one of the width, height, or width of the encoding unit, the image decoding device (100) can determine the size of the encoding unit.

[0086] According to one embodiment, the image decoding device (100) can determine the form of the encoding unit using block form information and can determine how the encoding unit is divided using division form mode information. That is, depending on what block form the block form information used by the image decoding device (100) represents, the method of dividing the encoding unit represented by the division form mode information can be determined.

[0087] The video decoder (100) can obtain split-form mode information from the bitstream. However, it is not limited thereto, and the video decoder (100) and the video encoding device (200) can determine pre-agreed split-form mode information based on block form information. The video decoder (100) can determine pre-agreed split-form mode information for a maximum encoding unit or a minimum encoding unit. For example, the video decoder (100) can determine the split-form mode information for the maximum encoding unit as quad split. Additionally, the video decoder (100) can determine the split-form mode information for the minimum encoding unit as "not split." Specifically, the video decoder (100) can determine the size of the maximum encoding unit to be 256x256. The video decoder (100) can determine the pre-agreed split-form mode information as quad split. Quad split is a split-form mode that divides both the width and height of the encoding unit into two equal parts. The image decoder (100) can obtain a 128x128 size encoding unit from a 256x256 size encoding unit based on the division mode information. Additionally, the image decoder (100) can determine the size of the minimum encoding unit to be 4x4. The image decoder (100) can obtain division mode information indicating "not divided" for the minimum encoding unit.

[0088] According to one embodiment, the image decoding device (100) may use block shape information indicating that the current encoding unit is in the shape of a square. For example, the image decoding device (100) may determine whether to not divide the square encoding unit, to divide it vertically, to divide it horizontally, or to divide it into four encoding units, etc., according to the division shape mode information. Referring to FIG. 3, when the block shape information of the current encoding unit (300) indicates a square shape, the decoding unit (120) may not divide the encoding unit (310a) having the same size as the current encoding unit (300) according to the division shape mode information indicating that it is not divided, or may determine the divided encoding units (310b, 310c, 310d, 310e, 310f, etc.) based on the division shape mode information indicating a predetermined division method.

[0089] Referring to FIG. 3, the image decoding device (100) can determine two encoding units (310b) that divide the current encoding unit (300) in the vertical direction based on splitting form mode information indicating that it is divided in the vertical direction according to one embodiment. The image decoding device (100) can determine two encoding units (310c) that divide the current encoding unit (300) in the horizontal direction based on splitting form mode information indicating that it is divided in the horizontal direction. The image decoding device (100) can determine four encoding units (310d) that divide the current encoding unit (300) in the vertical direction and the horizontal direction based on splitting form mode information indicating that it is divided in the vertical direction and the horizontal direction. The image decoding device (100) can determine three encoding units (310e) that divide the current encoding unit (300) in the vertical direction based on splitting form mode information indicating that it is divided ternary in the vertical direction according to one embodiment. The image decoding device (100) can determine three encoding units (310f) that divide the current encoding unit (300) horizontally based on division form mode information indicating horizontal division. However, the division form in which the square encoding unit can be divided should not be interpreted as being limited to the form described above, and may include various forms that the division form mode information can represent. The specific division forms in which the square encoding unit is divided will be described in detail below through various embodiments.

[0090] FIG. 4 illustrates a process in which, according to one embodiment, an image decoding device (100) divides a non-square-shaped encoding unit to determine at least one encoding unit.

[0091] According to one embodiment, the image decoding device (100) may use block shape information indicating that the current encoding unit is in a non-square shape. The image decoding device (100) may determine whether to not divide the current encoding unit of the non-square shape or to divide it in a predetermined way according to the division shape mode information. Referring to FIG. 4, when the block shape information of the current encoding unit (400 or 450) indicates a non-square shape, the image decoding device (100) may determine an encoding unit (410 or 460) having the same size as the current encoding unit (400 or 450) based on division shape mode information indicating that it is not divided, or determine divided encoding units (420a, 420b, 430a, 430b, 430c, 470a, 470b, 480a, 480b, 480c) based on division shape mode information indicating a predetermined division method. A predetermined division method in which a non-square encoding unit is divided will be specifically described below through various embodiments.

[0092] According to one embodiment, the image decoding device (100) can determine the form in which the encoding unit is divided using the division form mode information, and in this case, the division form mode information may indicate the number of at least one encoding unit generated by dividing the encoding unit. Referring to FIG. 4, when the division form mode information indicates that the current encoding unit (400 or 450) is divided into two encoding units, the image decoding device (100) can determine two encoding units (420a, 420b, or 470a, 470b) included in the current encoding unit by dividing the current encoding unit (400 or 450) based on the division form mode information.

[0093] According to one embodiment, when an image decoding device (100) divides a current encoding unit (400 or 450) in a non-square shape based on division shape mode information, the image decoding device (100) may divide the current encoding unit by considering the position of the long side of the current encoding unit (400 or 450) in a non-square shape. For example, the image decoding device (100) may determine a plurality of encoding units by dividing the current encoding unit (400 or 450) in a direction that divides the long side of the current encoding unit (400 or 450) by considering the shape of the current encoding unit (400 or 450).

[0094] According to one embodiment, when the segmentation mode information indicates that the encoding unit is divided into an odd number of blocks (terminal segmentation), the image decoder (100) can determine an odd number of encoding units included in the current encoding unit (400 or 450). For example, when the segmentation mode information indicates that the current encoding unit (400 or 450) is divided into three encoding units, the image decoder (100) can divide the current encoding unit (400 or 450) into three encoding units (430a, 430b, 430c, 480a, 480b, 480c).

[0095] According to one embodiment, the ratio of the width to the height of the current encoding unit (400 or 450) may be 4:1 or 1:4. When the ratio of the width to the height is 4:1, the block shape information may be in the horizontal direction because the width is longer than the height. When the ratio of the width to the height is 1:4, the block shape information may be in the vertical direction because the width is shorter than the height. The image decoder (100) may determine to divide the current encoding unit into an odd number of blocks based on the division shape mode information. Additionally, the image decoder (100) may determine the division direction of the current encoding unit (400 or 450) based on the block shape information of the current encoding unit (400 or 450). For example, if the current encoding unit (400) is in a vertical direction, the image decoding device (100) can determine the encoding units (430a, 430b, 430c) by dividing the current encoding unit (400) in a horizontal direction. Also, if the current encoding unit (450) is in a horizontal direction, the image decoding device (100) can determine the encoding units (480a, 480b, 480c) by dividing the current encoding unit (450) in a vertical direction.

[0096] According to one embodiment, the image decoding device (100) may determine an odd number of encoding units included in the current encoding unit (400 or 450), and the sizes of the determined encoding units may not all be the same. For example, among the determined odd number of encoding units (430a, 430b, 430c, 480a, 480b, 480c), the size of a certain encoding unit (430b or 480b) may have a different size from the other encoding units (430a, 430c, 480a, 480c). That is, the current encoding unit (400 or 450) can be divided and determined as a encoding unit, and the encoding unit can have multiple types of sizes, and in some cases, an odd number of encoding units (430a, 430b, 430c, 480a, 480b, 480c) may each have different sizes.

[0097] According to one embodiment, if the segmentation mode information indicates that the encoding unit is divided into an odd number of blocks, the image decoding device (100) can determine the odd number of encoding units included in the current encoding unit (400 or 450), and furthermore, the image decoding device (100) can impose a predetermined limit on at least one encoding unit among the odd number of encoding units generated by the segmentation. Referring to FIG. 4, the image decoding device (100) can perform the decoding process for the central encoding unit (430b, 480b) among the three encoding units (430a, 430b, 430c, 480a, 480b, 480c) generated by the segmentation of the current encoding unit (400 or 450) differently from the other encoding units (430a, 430c, 480a, 480c). For example, the video decoding device (100) may restrict the centrally located encoding unit (430b, 480b) from being further divided unlike other encoding units (430a, 430c, 480a, 480c), or restrict it to being divided only a predetermined number of times.

[0098] FIG. 5 illustrates a process in which an image decoding device (100) divides a encoding unit based on at least one of block form information and division form mode information according to one embodiment.

[0099] According to one embodiment, the image decoding device (100) may determine whether to divide a square-shaped first encoding unit (500) into encoding units or not to divide it based on at least one of block shape information and division shape mode information. According to one embodiment, if the division shape mode information indicates that the first encoding unit (500) is divided in a horizontal direction, the image decoding device (100) may divide the first encoding unit (500) in a horizontal direction to determine a second encoding unit (510). The first encoding unit, the second encoding unit, and the third encoding unit used according to one embodiment are terms used to understand the relationship before and after division between the encoding units. For example, if the first encoding unit is divided, the second encoding unit may be determined, and if the second encoding unit is divided, the third encoding unit may be determined. In the following, the relationship between the first encoding unit, the second encoding unit, and the third encoding unit used may be understood as following the features described above.

[0100] According to one embodiment, the image decoding device (100) may determine whether to divide the determined second encoding unit (510) into encoding units or not to divide it based on the division shape mode information. Referring to FIG. 5, the image decoding device (100) may divide the determined non-square second encoding unit (510) into at least one third encoding unit (520a, 520b, 520c, 520d, etc.) by dividing the first encoding unit (500) based on the division shape mode information, or may not divide the second encoding unit (510). The image decoding device (100) can obtain segmentation mode information, and the image decoding device (100) can divide a first encoding unit (500) based on the obtained segmentation mode information to divide a plurality of second encoding units (e.g., 510) of various forms, and the second encoding units (510) can be divided according to the method in which the first encoding unit (500) was divided based on the segmentation mode information. According to one embodiment, when the first encoding unit (500) is divided into a second encoding unit (510) based on the segmentation mode information for the first encoding unit (500), the second encoding unit (510) can also be divided into a third encoding unit (e.g., 520a, 520b, 520c, 520d, etc.) based on the segmentation mode information for the second encoding unit (510). That is, the encoding unit can be recursively partitioned based on partitioning mode information associated with each encoding unit. Thus, a square encoding unit can be determined from a non-square encoding unit, and a non-square encoding unit can be determined by recursively partitioning this square encoding unit.

[0101] Referring to FIG. 5, among the odd number of third encoding units (520b, 520c, 520d) determined by dividing a second encoding unit (510) of a non-square shape, a predetermined encoding unit (e.g., a central encoding unit or a square encoding unit) may be recursively divided. According to one embodiment, a third encoding unit (520b) of a non-square shape, which is one of the odd number of third encoding units (520b, 520c, 520d), may be divided horizontally into a plurality of fourth encoding units. A fourth encoding unit (530b or 530d) of a non-square shape, which is one of the plurality of fourth encoding units (530a, 530b, 530c, 530d), may again be divided into a plurality of encoding units. For example, a non-square fourth encoding unit (530b or 530d) may be further divided into an odd number of encoding units. Methods that can be used for the recursive division of encoding units will be described later through various embodiments.

[0102] According to one embodiment, the image decoding device (100) may divide each of the third encoding units (520a, 520b, 520c, 520d, etc.) into encoding units based on the division shape mode information. Additionally, the image decoding device (100) may decide not to divide the second encoding unit (510) based on the division shape mode information. According to one embodiment, the image decoding device (100) may divide the non-square second encoding unit (510) into an odd number of third encoding units (520b, 520c, 520d). The image decoding device (100) may place a certain limit on a certain third encoding unit among the odd number of third encoding units (520b, 520c, 520d). For example, the video decoding device (100) may limit the encoding unit (520c) located in the middle of the odd number of third encoding units (520b, 520c, 520d) so that it is not further divided or is limited to being divided a set number of times.

[0103] Referring to FIG. 5, the image decoding device (100) may limit the middle encoding unit (520c) among the odd number of third encoding units (520b, 520c, 520d) included in the second encoding unit (510) of a non-square shape to no longer be divided, to be divided into a predetermined division form (e.g., divided into only 4 encoding units or divided into a form corresponding to the divided form of the second encoding unit (510)), or to be divided only a predetermined number of times (e.g., divided only n times, n > 0). However, the above limitation on the middle encoding unit (520c) is merely a simple example and should not be interpreted as being limited to the above-described examples, but should be interpreted as including various limitations that allow the middle encoding unit (520c) to be decoded differently from the other encoding units (520b, 520d).

[0104] According to one embodiment, the image decoding device (100) can obtain splitting form mode information used to split the current encoding unit at a predetermined location within the current encoding unit.

[0105] FIG. 6 illustrates a method for an image decoding device (100) to determine a predetermined encoding unit among an odd number of encoding units according to one embodiment.

[0106] Referring to FIG. 6, the segmentation mode information of the current encoding unit (600, 650) can be obtained from a sample at a specific location among a plurality of samples included in the current encoding unit (600, 650) (e.g., a sample located in the center (640, 690)). However, the specific location within the current encoding unit (600) where at least one of such segmentation mode information can be obtained should not be interpreted as being limited to the center location shown in FIG. 6, and should be interpreted as including various locations within the current encoding unit (600) (e.g., top, bottom, left, right, top-left, bottom-left, top-right, or bottom-right, etc.). The image decoding device (100) can obtain the segmentation mode information obtained from the specific location and decide whether to divide the current encoding unit into encoding units of various shapes and sizes or not to divide it.

[0107] According to one embodiment, the image decoding device (100) may select one of the encoding units when the current encoding unit is divided into a predetermined number of encoding units. There may be various methods for selecting one of the multiple encoding units, and such methods will be described later through various embodiments below.

[0108] According to one embodiment, the image decoding device (100) can divide the current encoding unit into a plurality of encoding units and determine the encoding unit at a predetermined position.

[0109] According to one embodiment, the image decoding device (100) may use information indicating the location of each of the odd number of encoding units to determine the encoding unit located in the middle among the odd number of encoding units. Referring to FIG. 6, the image decoding device (100) may divide the current encoding unit (600) or the current encoding unit (650) to determine the odd number of encoding units (620a, 620b, 620c) or the odd number of encoding units (660a, 660b, 660c). The image decoding device (100) may determine the middle encoding unit (620b) or the middle encoding unit (660b) by using information regarding the location of the odd number of encoding units (620a, 620b, 620c) or the odd number of encoding units (660a, 660b, 660c). For example, the image decoding device (100) can determine the centrally located encoding unit (620b) by determining the positions of the encoding units (620a, 620b, 620c) based on information indicating the positions of a predetermined sample included in the encoding units (620a, 620b, 620c). Specifically, the image decoding device (100) can determine the centrally located encoding unit (620b) by determining the positions of the encoding units (620a, 620b, 620c) based on information indicating the positions of the upper-left samples (630a, 630b, 630c) of the encoding units (620a, 620b, 620c).

[0110] According to one embodiment, information indicating the location of the upper-left sample (630a, 630b, 630c) included in each of the encoding units (620a, 620b, 620c) may include information regarding the location or coordinates within the picture of the encoding units (620a, 620b, 620c). According to one embodiment, information indicating the location of the upper-left sample (630a, 630b, 630c) included in each of the encoding units (620a, 620b, 620c) may include information indicating the width or height of the encoding units (620a, 620b, 620c) included in the current encoding unit (600), and such width or height may correspond to information indicating the difference between coordinates within the picture of the encoding units (620a, 620b, 620c). That is, the image decoding device (100) can determine the centrally located encoding unit (620b) by directly using information about the position or coordinates of the encoding units (620a, 620b, 620c) within the picture, or by using information about the width or height of the encoding unit corresponding to the difference value between the coordinates.

[0111] According to one embodiment, information indicating the location of the upper left sample (630a) of the upper encoding unit (620a) may be represented by the (xa, ya) coordinates, information indicating the location of the upper left sample (530b) of the middle encoding unit (620b) may be represented by the (xb, yb) coordinates, and information indicating the location of the upper left sample (630c) of the lower encoding unit (620c) may be represented by the (xc, yc) coordinates. The image decoding device (100) can determine the middle encoding unit (620b) using the coordinates of the upper left samples (630a, 630b, 630c) included in each of the encoding units (620a, 620b, 620c). For example, when the coordinates of the upper-left samples (630a, 630b, 630c) are sorted in ascending or descending order, the encoding unit (620b) containing the coordinates (xb, yb) of the sample (630b) located in the middle can be determined as the encoding unit located in the middle among the encoding units (620a, 620b, 620c) determined by dividing the current encoding unit (600). However, the coordinates indicating the position of the upper-left samples (630a, 630b, 630c) may represent absolute positions within the picture, and furthermore, based on the position of the upper-left sample (630a) of the upper-left of the upper-left of the middle encoding unit (620b), the (dxb, dyb) coordinates, which represent the relative position of the upper-left sample (630b) of the middle encoding unit (620b), and the (dxc, dyc) coordinates, which represent the relative position of the upper-left sample (630c) of the lower encoding unit (620c) may also be used. In addition, the method of determining the encoding unit of a predetermined position by using the coordinates of the corresponding sample as information indicating the position of the sample included in the encoding unit should not be interpreted as being limited to the method described above, but should be interpreted as various arithmetic methods that can use the coordinates of the sample.

[0112] According to one embodiment, the image decoding device (100) can divide the current encoding unit (600) into a plurality of encoding units (620a, 620b, 620c) and select an encoding unit among the encoding units (620a, 620b, 620c) according to a predetermined criterion. For example, the image decoding device (100) can select an encoding unit (620b) of a different size among the encoding units (620a, 620b, 620c).

[0113] According to one embodiment, the image decoding device (100) can determine the width or height of each of the encoding units (620a, 620b, 620c) using the (xa, ya) coordinates, which are information indicating the location of the upper left sample (630a) of the upper encoding unit (620a), the (xb, yb) coordinates, which are information indicating the location of the upper left sample (630b) of the middle encoding unit (620b), and the (xc, yc) coordinates, which are information indicating the location of the upper left sample (630c) of the lower encoding unit (620c). The image decoding device (100) can determine the size of each of the encoding units (620a, 620b, 620c) using the (xa, ya), (xb, yb), and (xc, yc) coordinates, which are information indicating the location of the encoding units (620a, 620b, 620c). According to one embodiment, the image decoding device (100) may determine the width of the upper encoding unit (620a) as the width of the current encoding unit (600). The image decoding device (100) may determine the height of the upper encoding unit (620a) as yb-ya. According to one embodiment, the image decoding device (100) may determine the width of the middle encoding unit (620b) as the width of the current encoding unit (600). The image decoding device (100) may determine the height of the middle encoding unit (620b) as yc-yb. According to one embodiment, the image decoding device (100) may determine the width or height of the lower encoding unit using the width or height of the current encoding unit and the width and height of the upper encoding unit (620a) and the middle encoding unit (620b). The video decoding device (100) can determine a encoding unit having a different size from other encoding units based on the width and height of the determined encoding units (620a, 620b, 620c).Referring to FIG. 6, the image decoding device (100) can determine a middle encoding unit (620b) having a size different from that of the upper encoding unit (620a) and the lower encoding unit (620c) as the encoding unit of a predetermined position. However, since the process of the image decoding device (100) described above determining the encoding unit having a size different from other encoding units is merely one embodiment of determining the encoding unit of a predetermined position using the size of the encoding unit determined based on sample coordinates, various processes of determining the encoding unit of a predetermined position by comparing the size of the encoding unit determined according to the predetermined sample coordinates may be used.

[0114] The image decoding device (100) can determine the width or height of each of the encoding units (660a, 660b, 660c) using the (xd, yd) coordinates, which are information indicating the location of the upper-left sample (670a) of the left encoding unit (660a), the (xe, ye) coordinates, which are information indicating the location of the upper-left sample (670b) of the middle encoding unit (660b), and the (xf, yf) coordinates, which are information indicating the location of the upper-left sample (670c) of the right encoding unit (660c). The image decoding device (100) can determine the size of each of the encoding units (660a, 660b, 660c) using the (xd, yd), (xe, ye), and (xf, yf) coordinates, which are information indicating the location of the encoding units (660a, 660b, 660c).

[0115] According to one embodiment, the image decoding device (100) may determine the width of the left encoding unit (660a) as xe-xd. The image decoding device (100) may determine the height of the left encoding unit (660a) as the height of the current encoding unit (650). According to one embodiment, the image decoding device (100) may determine the width of the middle encoding unit (660b) as xf-xe. The image decoding device (100) may determine the height of the middle encoding unit (660b) as the height of the current encoding unit (600). According to one embodiment, the image decoding device (100) may determine the width or height of the right encoding unit (660c) using the width or height of the current encoding unit (650) and the width and height of the left encoding unit (660a) and the middle encoding unit (660b). The image decoding device (100) can determine a encoding unit having a different size from other encoding units based on the width and height of the determined encoding units (660a, 660b, 660c). Referring to FIG. 6, the image decoding device (100) can determine a middle encoding unit (660b) having a different size from the left encoding unit (660a) and the right encoding unit (660c) as the encoding unit of a predetermined position. However, since the process of the image decoding device (100) described above determining a encoding unit having a different size from other encoding units is merely one embodiment of determining the encoding unit of a predetermined position using the size of the encoding unit determined based on sample coordinates, various processes of determining the encoding unit of a predetermined position by comparing the size of the encoding unit determined according to the predetermined sample coordinates may be used.

[0116] However, the sample location considered to determine the location of the encoding unit should not be interpreted as being limited to the upper left corner described above, and can be interpreted as allowing the use of information regarding the location of any sample included in the encoding unit.

[0117] According to one embodiment, the image decoding device (100) may select an encoding unit at a predetermined position among an odd number of encoding units determined by dividing the current encoding unit, taking into account the shape of the current encoding unit. For example, if the current encoding unit is a non-square shape where the width is longer than the height, the image decoding device (100) may determine an encoding unit at a predetermined position according to the horizontal direction. That is, the image decoding device (100) may determine one of the encoding units at different positions in the horizontal direction and place a restriction on that encoding unit. If the current encoding unit is a non-square shape where the height is longer than the width, the image decoding device (100) may determine an encoding unit at a predetermined position according to the vertical direction. That is, the image decoding device (100) may determine one of the encoding units at different positions in the vertical direction and place a restriction on that encoding unit.

[0118] According to one embodiment, the image decoding device (100) may use information indicating the location of each of the even number of encoding units to determine the encoding unit at a predetermined location among the even number of encoding units. The image decoding device (100) may determine the even number of encoding units by dividing (binary division) the current encoding unit and may determine the encoding unit at a predetermined location using information regarding the locations of the even number of encoding units. Since the specific process for this may correspond to the process of determining the encoding unit at a predetermined location (e.g., the middle location) among the odd number of encoding units described above in FIG. 6, it is omitted.

[0119] According to one embodiment, when a current encoding unit in a non-square shape is divided into a plurality of encoding units, certain information regarding the encoding unit at a certain position may be used during the division process to determine the encoding unit at a certain position among the plurality of encoding units. For example, the image decoding device (100) may use at least one of block shape information and division shape mode information stored in a sample included in the middle encoding unit during the division process to determine the encoding unit located in the middle among the encoding units into which the current encoding unit is divided into a plurality of encoding units.

[0120] Referring to FIG. 6, the image decoding device (100) can divide the current encoding unit (600) into a plurality of encoding units (620a, 620b, 620c) based on the division form mode information, and can determine the encoding unit (620b) located in the middle among the plurality of encoding units (620a, 620b, 620c). Furthermore, the image decoding device (100) can determine the encoding unit (620b) located in the middle by considering the location where the division form mode information is obtained. That is, the segmentation mode information of the current encoding unit (600) can be obtained from a sample (640) located in the middle of the current encoding unit (600), and based on the segmentation mode information, if the current encoding unit (600) is divided into a plurality of encoding units (620a, 620b, 620c), the encoding unit (620b) containing the sample (640) can be determined as the encoding unit located in the middle. However, the information used to determine the encoding unit located in the middle should not be interpreted as being limited to segmentation mode information, and various types of information may be used in the process of determining the encoding unit located in the middle.

[0121] According to one embodiment, a predetermined information for identifying a coding unit at a predetermined location may be obtained from a predetermined sample included in the coding unit to be determined. Referring to FIG. 6, an image decoding device (100) may use a segmentation mode information obtained from a sample at a predetermined location within the current coding unit (600) (for example, a sample at the center of the current coding unit (600)) to determine a coding unit at a predetermined location (for example, a coding unit located in the center of the multiple divided coding units) among a plurality of coding units (620a, 620b, 620c) determined by dividing the current coding unit (600). That is, the image decoding device (100) can determine a sample at the predetermined position by considering the block shape of the current encoding unit (600), and the image decoding device (100) can determine a encoding unit (620b) containing a sample from which certain information (e.g., division shape mode information) can be obtained among a plurality of encoding units (620a, 620b, 620c) from which the current encoding unit (600) is divided and determined, and can impose a certain limit. Referring to FIG. 6, according to one embodiment, the image decoding device (100) can determine a sample (640) located in the middle of the current encoding unit (600) as a sample from which certain information can be obtained, and the image decoding device (100) can impose a certain limit on the encoding unit (620b) containing such a sample (640) during the decoding process. However, the location of the sample from which the specified information can be obtained should not be interpreted as being limited to the location described above, but can be interpreted as samples at any location included in the encoding unit (620b) to be determined for the purpose of imposing a limit.

[0122] According to one embodiment, the location of a sample from which a predetermined information can be obtained may be determined according to the shape of the current encoding unit (600). According to one embodiment, block shape information may determine whether the shape of the current encoding unit is square or non-square, and may determine the location of a sample from which a predetermined information can be obtained according to the shape. For example, the image decoding device (100) may determine a sample located on a boundary that divides at least one of the width and height of the current encoding unit in half using at least one of the information regarding the width and height of the current encoding unit as a sample from which a predetermined information can be obtained. As another example, if the block shape information related to the current encoding unit indicates that it is a non-square shape, the image decoding device (100) may determine one of the samples adjacent to the boundary that divides the long side of the current encoding unit in half as a sample from which a predetermined information can be obtained.

[0123] According to one embodiment, when the image decoding device (100) divides the current encoding unit into a plurality of encoding units, it may use division form mode information to determine the encoding unit at a predetermined position among the plurality of encoding units. According to one embodiment, the image decoding device (100) may obtain division form mode information from a sample at a predetermined position included in the encoding unit, and the image decoding device (100) may divide the plurality of encoding units generated by dividing the current encoding unit using the division form mode information obtained from a sample at a predetermined position included in each of the plurality of encoding units. That is, the encoding unit may be recursively divided using the division form mode information obtained from a sample at a predetermined position included in each of the encoding units. Since the recursive division process of the encoding unit has been described in detail through FIG. 5, a detailed explanation will be omitted.

[0124] According to one embodiment, the image decoding device (100) can determine at least one encoding unit by dividing the current encoding unit, and can determine the order in which the at least one encoding unit is decoded according to a predetermined block (e.g., the current encoding unit).

[0125] FIG. 7 illustrates the order in which a plurality of encoding units are processed when an image decoding device (100) determines a plurality of encoding units by dividing a current encoding unit according to one embodiment.

[0126] According to one embodiment, the image decoding device (100) may determine a second encoding unit (710a, 710b) by dividing a first encoding unit (700) in a vertical direction according to the splitting form mode information, determine a second encoding unit (730a, 730b) by dividing the first encoding unit (700) in a horizontal direction, or determine a second encoding unit (750a, 750b, 750c, 750d) by dividing the first encoding unit (700) in both a vertical and a horizontal direction.

[0127] Referring to FIG. 7, the image decoding device (100) can determine the order of processing the determined second encoding units (710a, 710b) in the horizontal direction (710c) by dividing the first encoding unit (700) in the vertical direction. The image decoding device (100) can determine the processing order of the determined second encoding units (730a, 730b) in the vertical direction (730c) by dividing the first encoding unit (700) in the horizontal direction. The image decoding device (100) can determine the second encoding unit (750a, 750b, 750c, 750d) determined by dividing the first encoding unit (700) into vertical and horizontal directions, according to a predetermined order in which encoding units located in one row are processed and then encoding units located in the next row are processed (e.g., raster scan order or z scan order (750e), etc.).

[0128] According to one embodiment, the image decoding device (100) can recursively divide the encoding units. Referring to FIG. 7, the image decoding device (100) can divide the first encoding unit (700) to determine a plurality of encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d), and can recursively divide each of the determined plurality of encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d). A method of dividing multiple encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d) may be a method corresponding to a method of dividing the first encoding unit (700). Accordingly, the multiple encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d) may each be independently divided into multiple encoding units. Referring to FIG. 7, the image decoding device (100) may determine the second encoding units (710a, 710b) by dividing the first encoding unit (700) in a vertical direction, and furthermore, may determine whether to independently divide or not divide each of the second encoding units (710a, 710b).

[0129] According to one embodiment, the image decoding device (100) may divide the second encoding unit (710a) on the left side horizontally into third encoding units (720a, 720b), and may not divide the second encoding unit (710b) on the right side.

[0130] According to one embodiment, the processing order of the encoding units may be determined based on the process of dividing the encoding units. In other words, the processing order of the divided encoding units may be determined based on the processing order of the encoding units immediately before they are divided. The image decoding device (100) may determine the processing order of the third encoding units (720a, 720b), which are determined by dividing the second encoding unit (710a) on the left, independently of the second encoding unit (710b) on the right. Since the third encoding units (720a, 720b) ​​are determined by dividing the second encoding unit (710a) on the left in a horizontal direction, the third encoding units (720a, 720b) ​​may be processed in a vertical direction (720c). In addition, since the processing order of the second encoding unit (710a) on the left and the second encoding unit (710b) on the right corresponds to the horizontal direction (710c), the third encoding unit (720a, 720b) ​​included in the second encoding unit (710a) on the left can be processed in the vertical direction (720c) before the right encoding unit (710b) is processed. The above description is intended to explain the process in which the processing order of the encoding units is determined according to the encoding unit before division, and therefore should not be interpreted as being limited to the above-described embodiment, but should be interpreted as being used in various ways in which encoding units determined by division in various forms can be processed independently according to a predetermined order.

[0131] FIG. 8 illustrates a process in which, according to one embodiment, an image decoding device (100) determines that the current encoding unit is divided into an odd number of encoding units when the encoding unit cannot be processed in a predetermined order.

[0132] According to one embodiment, the image decoding device (100) may determine that the current encoding unit is divided into an odd number of encoding units based on acquired segmentation mode information. Referring to FIG. 8, a square-shaped first encoding unit (800) may be divided into non-square-shaped second encoding units (810a, 810b), and the second encoding units (810a, 810b) may each be independently divided into third encoding units (820a, 820b, 820c, 820d, 820e). According to one embodiment, the image decoding device (100) can determine a plurality of third encoding units (820a, 820b) by dividing the left encoding unit (810a) among the second encoding units in a horizontal direction, and the right encoding unit (810b) can be divided into an odd number of third encoding units (820c, 820d, 820e).

[0133] According to one embodiment, the image decoding device (100) can determine whether there are an odd number of divided encoding units by determining whether the third encoding units (820a, 820b, 820c, 820d, 820e) can be processed in a predetermined order. Referring to FIG. 8, the image decoding device (100) can determine the third encoding units (820a, 820b, 820c, 820d, 820e) by recursively dividing the first encoding unit (800). The video decoding device (100) can determine whether the first encoding unit (800), the second encoding unit (810a, 810b), or the third encoding unit (820a, 820b, 820c, 820d, 820e) are divided into an odd number of encoding units based on at least one of block form information and division form mode information. For example, the encoding unit located on the right among the second encoding units (810a, 810b) may be divided into an odd number of third encoding units (820c, 820d, 820e). The order in which a plurality of encoding units included in the first encoding unit (800) are processed may be a predetermined order (e.g., z-scan order (830)), and the image decoding device (100) may determine whether the right second encoding unit (810b) is divided into an odd number of determined third encoding units (820c, 820d, 820e) can be processed according to the predetermined order.

[0134] According to one embodiment, the image decoding device (100) can determine whether the third encoding unit (820a, 820b, 820c, 820d, 820e) included in the first encoding unit (800) satisfies a condition that the third encoding unit (820a, 820b, 820c, 820d, 820e) can be processed in a predetermined order, and the condition relates to whether at least one of the width and height of the second encoding unit (810a, 810b) is divided in half according to the boundary of the third encoding unit (820a, 820b, 820c, 820d, 820e). For example, the third encoding unit (820a, 820b) determined by dividing the height of the left second encoding unit (810a) in a non-square shape in half can satisfy the condition. Since the boundaries of the third encoding units (820c, 820d, 820e), which are determined by dividing the right second encoding unit (810b) into three encoding units, do not divide the width or height of the right second encoding unit (810b) in half, the third encoding units (820c, 820d, 820e) may be determined not to satisfy the condition. In the case of such non-satisfaction of the condition, the image decoding device (100) determines that there is a disconnection in the scan order, and based on the result of the determination, the right second encoding unit (810b) may be determined to be divided into an odd number of encoding units. According to one embodiment, when the image decoding device (100) is divided into an odd number of encoding units, it may place a certain restriction on the encoding unit at a certain position among the divided encoding units, and since the details of such restriction or the certain position, etc., have been described in detail through various embodiments, a detailed explanation will be omitted.

[0135] FIG. 9 illustrates a process in which an image decoding device (100) divides a first encoding unit (900) to determine at least one encoding unit according to one embodiment.

[0136] According to one embodiment, the image decoding device (100) may divide the first encoding unit (900) based on the segmentation form mode information obtained through the bitstream acquisition unit (110). The first encoding unit (900) in a square shape may be divided into four square-shaped encoding units or into a plurality of non-square-shaped encoding units. For example, referring to FIG. 9, the first encoding unit (900) is square and the segmentation form mode information indicates that it is divided into non-square encoding units, so the image decoding device (100) may divide the first encoding unit (900) into a plurality of non-square encoding units. Specifically, when the splitting mode information indicates that the first encoding unit (900) is divided in a horizontal or vertical direction to determine an odd number of encoding units, the image decoding device (100) can divide the square-shaped first encoding unit (900) into an odd number of encoding units, such as a second encoding unit (910a, 910b, 910c) determined by dividing in a vertical direction or a second encoding unit (920a, 920b, 920c) determined by dividing in a horizontal direction.

[0137] According to one embodiment, the image decoding device (100) can determine whether the second encoding unit (910a, 910b, 910c, 920a, 920b, 920c) included in the first encoding unit (900) satisfies a condition that the second encoding unit (910a, 910b, 910c, 920a, 920b, 920c) can be processed in a predetermined order, and the condition relates to whether at least one of the width and height of the first encoding unit (900) is divided in half according to the boundary of the second encoding unit (910a, 910b, 910c, 920a, 920b, 920c). Referring to FIG. 9, the boundaries of the second encoding units (910a, 910b, 910c), which are determined by dividing the square-shaped first encoding unit (900) in the vertical direction, do not divide the width of the first encoding unit (900) in half, so the first encoding unit (900) may be determined not to satisfy the condition of being processed in a predetermined order. Additionally, the boundaries of the second encoding units (920a, 920b, 920c), which are determined by dividing the square-shaped first encoding unit (900) in the horizontal direction, do not divide the height of the first encoding unit (900) in half, so the first encoding unit (900) may be determined not to satisfy the condition of being processed in a predetermined order. The image decoding device (100) determines that if these conditions are not satisfied, there is a disconnection in the scan order, and based on the result of the determination, the first encoding unit (900) may be divided into an odd number of encoding units. According to one embodiment, when the image decoding device (100) is divided into an odd number of encoding units, it may place a certain restriction on the encoding unit at a certain position among the divided encoding units. Since the details of such restriction or the certain position have been described in detail through various embodiments, a detailed explanation will be omitted.

[0138] According to one embodiment, the image decoding device (100) can divide the first encoding unit to determine various forms of encoding units.

[0139] Referring to FIG. 9, the image decoding device (100) can divide a square-shaped first encoding unit (900) and a non-square-shaped first encoding unit (930 or 950) into various types of encoding units.

[0140] FIG. 10 illustrates that, according to one embodiment, when a video decoding device (100) divides a first encoding unit (1000) and a second encoding unit of a non-square shape determined by the division satisfies a predetermined condition, the shape in which the second encoding unit can be divided is limited.

[0141] According to one embodiment, the image decoding device (100) may decide to divide a square-shaped first encoding unit (1000) into non-square-shaped second encoding units (1010a, 1010b, 1020a, 1020b) based on division shape mode information obtained through a bitstream acquisition unit (110). The second encoding units (1010a, 1010b, 1020a, 1020b) may be divided independently. Accordingly, the image decoding device (100) may decide to divide into a plurality of encoding units or not divide based on division shape mode information related to each of the second encoding units (1010a, 1010b, 1020a, 1020b). According to one embodiment, the image decoding device (100) may determine a third encoding unit (1012a, 1012b) by dividing the left second encoding unit (1010a), which is a non-square shape determined by dividing the first encoding unit (1000) in the vertical direction, in the horizontal direction. However, when the image decoding device (100) divides the left second encoding unit (1010a) in the horizontal direction, the right second encoding unit (1010b) may be restricted so that it cannot be divided in the same horizontal direction as the left second encoding unit (1010a). If the right second encoding unit (1010b) is divided in the same direction to determine the third encoding unit (1014a, 1014b), the left second encoding unit (1010a) and the right second encoding unit (1010b) may be divided independently in the horizontal direction to determine the third encoding unit (1012a, 1012b, 1014a, 1014b). However, this is the same result as the image decoding device (100) dividing the first encoding unit (1000) into four square-shaped second encoding units (1030a, 1030b, 1030c, 1030d) based on the division shape mode information, and this may be inefficient in terms of image decoding.

[0142] According to one embodiment, the image decoding device (100) may determine a third encoding unit (1022a, 1022b, 1024a, 1024b) by dividing a first encoding unit (1000) in a horizontal direction and a second encoding unit (1020a or 1020b) in a non-square shape in a vertical direction. However, if the image decoding device (100) divides one of the second encoding units (e.g., the upper second encoding unit (1020a)) in a vertical direction, it may restrict the other second encoding unit (e.g., the lower encoding unit (1020b)) from being divided in the same vertical direction as the upper second encoding unit (1020a) in accordance with the above-described reason.

[0143] FIG. 11 illustrates the process of a video decoder (100) dividing square-shaped encoding units when, according to one embodiment, the divided shape mode information cannot be divided into four square-shaped encoding units.

[0144] According to one embodiment, the image decoding device (100) can determine the second encoding unit (1110a, 1110b, 1120a, 1120b, etc.) by dividing the first encoding unit (1100) based on the division shape mode information. The division shape mode information may include information on various shapes in which the encoding unit can be divided, but the information on various shapes may not include information for dividing into four square-shaped encoding units. According to this division shape mode information, the image decoding device (100) cannot divide the square-shaped first encoding unit (1100) into four square-shaped second encoding units (1130a, 1130b, 1130c, 1130d). Based on the segmented form mode information, the image decoding device (100) can determine a non-square second encoding unit (1110a, 1110b, 1120a, 1120b, etc.).

[0145] According to one embodiment, the image decoding device (100) can independently divide each of the second encoding units (1110a, 1110b, 1120a, 1120b, etc.) in a non-square shape. Each of the second encoding units (1110a, 1110b, 1120a, 1120b, etc.) can be divided in a predetermined order through a recursive method, and this may be a division method corresponding to the method in which the first encoding unit (1100) is divided based on division shape mode information.

[0146] For example, the image decoding device (100) can determine a square-shaped third encoding unit (1112a, 1112b) by dividing the left second encoding unit (1110a) in a horizontal direction, and can determine a square-shaped third encoding unit (1114a, 1114b) by dividing the right second encoding unit (1110b) in a horizontal direction. Furthermore, the image decoding device (100) can determine a square-shaped third encoding unit (1116a, 1116b, 1116c, 1116d) by dividing both the left second encoding unit (1110a) and the right second encoding unit (1110b) in a horizontal direction. In this case, the encoding unit can be determined in the same form as the first encoding unit (1100) being divided into four square-shaped second encoding units (1130a, 1130b, 1130c, 1130d).

[0147] As another example, the video decoding device (100) may determine a square-shaped third encoding unit (1122a, 1122b) by dividing the upper second encoding unit (1120a) in a vertical direction, and determine a square-shaped third encoding unit (1124a, 1124b) by dividing the lower second encoding unit (1120b) in a vertical direction. Furthermore, the video decoding device (100) may determine a square-shaped third encoding unit (1126a, 1126b, 1126a, 1126b) by dividing both the upper second encoding unit (1120a) and the lower second encoding unit (1120b) in a vertical direction. In this case, the encoding unit can be determined in the same form as the first encoding unit (1100) being divided into four square-shaped second encoding units (1130a, 1130b, 1130c, 1130d).

[0148] FIG. 12 illustrates that, according to one embodiment, the processing order between a plurality of encoding units may vary depending on the division process of the encoding unit.

[0149] According to one embodiment, the image decoding device (100) may divide the first encoding unit (1200) based on the division shape mode information. When the block shape is square and the division shape mode information indicates that the first encoding unit (1200) is divided in at least one of the horizontal direction and the vertical direction, the image decoding device (100) may divide the first encoding unit (1200) to determine the second encoding unit (e.g., 1210a, 1210b, 1220a, 1220b, etc.). Referring to FIG. 12, the second encoding units (1210a, 1210b, 1220a, 1220b) in a non-square shape determined by dividing the first encoding unit (1200) only in the horizontal direction or the vertical direction may be divided independently based on the division shape mode information for each. For example, the video decoding device (100) can determine the third encoding unit (1216a, 1216b, 1216c, 1216d) by dividing the second encoding unit (1210a, 1210b) generated by dividing the first encoding unit (1200) in the vertical direction, and can determine the third encoding unit (1226a, 1226b, 1226c, 1226d) by dividing the second encoding unit (1220a, 1220b) generated by dividing the first encoding unit (1200) in the horizontal direction, respectively, in the vertical direction. Since the process of dividing these second encoding units (1210a, 1210b, 1220a, 1220b) has been described in detail in relation to FIG. 11, a detailed explanation will be omitted.

[0150] According to one embodiment, the image decoding device (100) can process encoding units in a predetermined order. Since the characteristics of processing encoding units in a predetermined order have been described in detail in relation to FIG. 7, a detailed explanation will be omitted. Referring to FIG. 12, the image decoding device (100) can divide a square-shaped first encoding unit (1200) to determine four square-shaped third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d). According to one embodiment, the image decoding device (100) can determine the processing order of the third encoding unit (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) according to the form in which the first encoding unit (1200) is divided.

[0151] According to one embodiment, the image decoding device (100) can determine the third encoding unit (1216a, 1216b, 1216c, 1216d) by dividing the second encoding unit (1210a, 1210b) generated by dividing in the vertical direction into the horizontal direction, and the image decoding device (100) can process the third encoding unit (1216a, 1216b, 1216c, 1216d) according to the order (1217) of first processing the third encoding unit (1216a, 1216c) included in the left second encoding unit (1210a) in the vertical direction, and then processing the third encoding unit (1216b, 1216d) included in the right second encoding unit (1210b) in the vertical direction.

[0152] According to one embodiment, the image decoding device (100) can determine the third encoding unit (1226a, 1226b, 1226c, 1226d) by dividing the second encoding unit (1220a, 1220b) generated by dividing in the horizontal direction into the vertical direction, and the image decoding device (100) can process the third encoding unit (1226a, 1226b, 1226c, 1226d) according to the order (1227) of first processing the third encoding unit (1226a, 1226b) included in the upper second encoding unit (1220a) in the horizontal direction, and then processing the third encoding unit (1226c, 1226d) included in the lower second encoding unit (1220b) in the horizontal direction.

[0153] Referring to FIG. 12, the second encoding units (1210a, 1210b, 1220a, 1220b) are each divided to determine the square-shaped third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d). The second encoding unit (1210a, 1210b) determined by dividing in the vertical direction and the second encoding unit (1220a, 1220b) determined by dividing in the horizontal direction are divided into different forms, but according to the third encoding unit (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) determined thereafter, the result is that the first encoding unit (1200) is divided into encoding units of the same form. Accordingly, the image decoding device (100) recursively divides the encoding unit through different processes based on the division form mode information, so that even if the encoding units of the same form are determined as a result, the multiple encoding units determined in the same form can be processed in different orders.

[0154] FIG. 13 illustrates a process in which, according to one embodiment, a encoding unit is recursively divided to determine a plurality of encoding units, and the depth of the encoding unit is determined as the shape and size of the encoding unit change.

[0155] According to one embodiment, the image decoding device (100) may determine the depth of the encoding unit according to a predetermined standard. For example, the predetermined standard may be the length of the long side of the encoding unit. The image decoding device (100) may determine that if the length of the long side of the current encoding unit is divided by 2n (n>0) times the length of the long side of the encoding unit before division, the depth of the current encoding unit is increased by n compared to the depth of the encoding unit before division. In the following, the encoding unit with increased depth is expressed as a lower depth encoding unit.

[0156] Referring to FIG. 13, according to one embodiment, based on block shape information indicating that it is a square shape (for example, the block shape information may indicate '0: SQUARE'), an image decoding device (100) can determine a second encoding unit (1302), a third encoding unit (1304), etc. of a lower depth by dividing a first encoding unit (1300) that is square in shape. If the size of the first encoding unit (1300) that is square in shape is 2Nx2N, the second encoding unit (1302), which is determined by dividing the width and height of the first encoding unit (1300) by half, may have a size of NxN. Furthermore, the third encoding unit (1304), which is determined by dividing the width and height of the second encoding unit (1302) by half, may have a size of N / 2xN / 2. In this case, the width and height of the third encoding unit (1304) correspond to 1 / 4 times the width and height of the first encoding unit (1300). When the depth of the first encoding unit (1300) is D, the depth of the second encoding unit (1302), which is 1 / 2 times the width and height of the first encoding unit (1300), may be D+1, and the depth of the third encoding unit (1304), which is 1 / 4 times the width and height of the first encoding unit (1300), may be D+2.

[0157] According to one embodiment, based on block shape information representing a non-square shape (for example, the block shape information may represent '1: NS_VER' indicating that the height is longer than the width, or '2: NS_HOR' indicating that the width is longer than the height), the image decoding device (100) may divide a first encoding unit (1310 or 1320) that is a non-square shape to determine a second encoding unit (1312 or 1322), a third encoding unit (1314 or 1324), etc. of a lower depth.

[0158] The image decoding device (100) can determine a second encoding unit (e.g., 1302, 1312, 1322, etc.) by dividing at least one of the width and height of a first encoding unit (1310) of size Nx2N. That is, the image decoding device (100) can determine a second encoding unit (1302) of size NxN or a second encoding unit (1322) of size NxN / 2 by dividing the first encoding unit (1310) in a horizontal direction, and can also determine a second encoding unit (1312) of size N / 2xN by dividing it in a horizontal direction and a vertical direction.

[0159] According to one embodiment, the image decoding device (100) may determine a second encoding unit (e.g., 1302, 1312, 1322, etc.) by dividing at least one of the width and height of a first encoding unit (1320) of size 2NxN. That is, the image decoding device (100) may determine a second encoding unit (1302) of size NxN or a second encoding unit (1312) of size N / 2xN by dividing the first encoding unit (1320) in the vertical direction, and may determine a second encoding unit (1322) of size NxN / 2 by dividing it in the horizontal and vertical directions.

[0160] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by dividing at least one of the width and height of a second encoding unit (1302) of size NxN. That is, the image decoding device (100) may determine a third encoding unit (1304) of size N / 2xN / 2 by dividing the second encoding unit (1302) in a vertical direction and a horizontal direction, or determine a third encoding unit (1314) of size N / 4xN / 2, or determine a third encoding unit (1324) of size N / 2xN / 4.

[0161] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by dividing at least one of the width and height of a second encoding unit (1312) of size N / 2xN. That is, the image decoding device (100) may determine a third encoding unit (1304) of size N / 2xN / 2 or a third encoding unit (1324) of size N / 2xN / 4 by dividing the second encoding unit (1312) in a horizontal direction, or determine a third encoding unit (1314) of size N / 4xN / 2 by dividing it in a vertical direction and a horizontal direction.

[0162] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by dividing at least one of the width and height of a second encoding unit (1322) of size NxN / 2. That is, the image decoding device (100) may determine a third encoding unit (1304) of size N / 2xN / 2 or a third encoding unit (1314) of size N / 4xN / 2 by dividing the second encoding unit (1322) in the vertical direction, or determine a third encoding unit (1324) of size N / 2xN / 4 by dividing it in the vertical and horizontal directions.

[0163] According to one embodiment, the image decoding device (100) may divide square-shaped encoding units (e.g., 1300, 1302, 1304) in a horizontal or vertical direction. For example, a first encoding unit (1300) of size 2Nx2N may be divided in a vertical direction to determine a first encoding unit (1310) of size Nx2N, or divided in a horizontal direction to determine a first encoding unit (1320) of size 2NxN. According to one embodiment, when the depth is determined based on the length of the longest side of the encoding unit, the depth of the encoding unit determined by dividing the first encoding unit (1300) of size 2Nx2N in a horizontal or vertical direction may be the same as the depth of the first encoding unit (1300).

[0164] According to one embodiment, the width and height of the third encoding unit (1314 or 1324) may correspond to 1 / 4 times the width and height of the first encoding unit (1310 or 1320). If the depth of the first encoding unit (1310 or 1320) is D, the depth of the second encoding unit (1312 or 1322), which is 1 / 2 times the width and height of the first encoding unit (1310 or 1320), may be D+1, and the depth of the third encoding unit (1314 or 1324), which is 1 / 4 times the width and height of the first encoding unit (1310 or 1320), may be D+2.

[0165] FIG. 14 illustrates a depth and part index (hereinafter PID) for distinguishing between coding units that can be determined according to the shape and size of the coding units according to one embodiment.

[0166] According to one embodiment, the image decoding device (100) can determine various shapes of second encoding units by dividing a square-shaped first encoding unit (1400). Referring to FIG. 14, the image decoding device (100) can determine second encoding units (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d) by dividing the first encoding unit (1400) in at least one of a vertical direction and a horizontal direction according to the division shape mode information. That is, the image decoding device (100) can determine the second encoding unit (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d) based on the segmented form mode information for the first encoding unit (1400).

[0167] According to one embodiment, the depth of the second encoding unit (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d), which is determined according to the segmented shape mode information for the first encoding unit (1400) in a square shape, can be determined based on the length of the longer side. For example, since the length of one side of the first encoding unit (1400) in a square shape and the length of the longer side of the second encoding unit (1402a, 1402b, 1404a, 1404b) in a non-square shape are the same, the depth of the first encoding unit (1400) and the second encoding unit (1402a, 1402b, 1404a, 1404b) in a non-square shape can be considered to be the same as D. In contrast, when the video decoding device (100) divides the first encoding unit (1400) into four square-shaped second encoding units (1406a, 1406b, 1406c, 1406d) based on the division shape mode information, since the length of one side of the square-shaped second encoding units (1406a, 1406b, 1406c, 1406d) is half the length of one side of the first encoding unit (1400), the depth of the second encoding units (1406a, 1406b, 1406c, 1406d) may be a depth of D+1, which is one depth lower than the depth D of the first encoding unit (1400).

[0168] According to one embodiment, the image decoding device (100) may divide a first encoding unit (1410), in which the height is longer than the width, into a plurality of second encoding units (1412a, 1412b, 1414a, 1414b, 1414c) by dividing it in a horizontal direction according to the division shape mode information. According to one embodiment, the image decoding device (100) may divide a first encoding unit (1420), in which the width is longer than the height, into a plurality of second encoding units (1422a, 1422b, 1424a, 1424b, 1424c) by dividing it in a vertical direction according to the division shape mode information.

[0169] According to one embodiment, a second encoding unit (1412a, 1412b, 1414a, 1414b, 1414c, 1422a, 1422b, 1424a, 1424b, 1424c) determined according to the segmented shape mode information for a first encoding unit (1410 or 1420) of a non-square shape may have its depth determined based on the length of the longer side. For example, since the length of one side of the square-shaped second encoding unit (1412a, 1412b) is half the length of one side of the non-square-shaped first encoding unit (1410) in which the height is longer than the width, the depth of the square-shaped second encoding unit (1412a, 1412b) is D+1, which is one depth lower than the depth D of the non-square-shaped first encoding unit (1410).

[0170] Furthermore, the image decoding device (100) may divide a first encoding unit (1410) in a non-square shape into an odd number of second encoding units (1414a, 1414b, 1414c) based on the division shape mode information. The odd number of second encoding units (1414a, 1414b, 1414c) may include a second encoding unit (1414a, 1414c) in a non-square shape and a second encoding unit (1414b) in a square shape. In this case, since the length of the longer side of the non-square second encoding unit (1414a, 1414c) and the length of one side of the square second encoding unit (1414b) are half the length of one side of the first encoding unit (1410), the depth of the second encoding unit (1414a, 1414b, 1414c) may be a depth of D+1, which is one depth lower than the depth D of the first encoding unit (1410). The image decoding device (100) may determine the depth of the encoding units associated with the non-square first encoding unit (1420), in a manner corresponding to the above method of determining the depth of the encoding units associated with the first encoding unit (1410).

[0171] According to one embodiment, when determining an index (PID) for distinguishing divided encoding units, the video decoding device (100) may determine the index based on the size ratio between the encoding units when the odd number of divided encoding units are not of the same size. Referring to FIG. 14, the encoding unit (1414b) located in the middle among the odd number of divided encoding units (1414a, 1414b, 1414c) may have the same width as the other encoding units (1414a, 1414c) but may have twice the height of the other encoding units (1414a, 1414c). That is, in this case, the encoding unit (1414b) located in the middle may include two of the other encoding units (1414a, 1414c). Accordingly, if the index (PID) of the encoding unit (1414b) located in the middle according to the scan order is 1, the encoding unit (1414c) located in the next order may have an index of 3, which is an increase of 2. That is, there may be a discontinuity in the index values. According to one embodiment, the image decoding device (100) may determine whether the encoding units divided into an odd number are not of the same size based on whether there is a discontinuity in the index for distinguishing between these divided encoding units.

[0172] According to one embodiment, the image decoding device (100) may determine whether a plurality of encoding units determined by dividing from the current encoding unit are divided into a specific division form based on the value of an index for distinguishing the plurality of encoding units. Referring to FIG. 14, the image decoding device (100) may divide a first encoding unit (1410) in the shape of a rectangle whose height is greater than its width to determine an even number of encoding units (1412a, 1412b) or an odd number of encoding units (1414a, 1414b, 1414c). The image decoding device (100) may use an index (PID) representing each encoding unit to distinguish each of the plurality of encoding units. According to one embodiment, the PID may be obtained from a sample at a predetermined position of each encoding unit (e.g., the upper left sample).

[0173] According to one embodiment, the image decoding device (100) can determine a coding unit at a predetermined position among the coding units determined by division using an index for distinguishing the coding units. According to one embodiment, if the division shape mode information for a first coding unit (1410) in the form of a rectangle whose height is longer than its width indicates that it is divided into three coding units, the image decoding device (100) can divide the first coding unit (1410) into three coding units (1414a, 1414b, 1414c). The image decoding device (100) can assign an index to each of the three coding units (1414a, 1414b, 1414c). The image decoding device (100) can compare the indices for each coding unit to determine the middle coding unit among the odd number of divided coding units. The image decoding device (100) may determine a encoding unit (1414b) having an index corresponding to the middle value among the indices based on the indices of the encoding units, as the encoding unit at the middle position among the encoding units determined by dividing the first encoding unit (1410). According to one embodiment, when determining an index for distinguishing the divided encoding units, the image decoding device (100) may determine the index based on the size ratio between the encoding units if the encoding units are not of the same size. Referring to FIG. 14, the encoding unit (1414b) generated by dividing the first encoding unit (1410) may have the same width as the other encoding units (1414a, 1414c) but may have a height twice that of the other encoding units (1414a, 1414c). In this case, if the index (PID) of the encoding unit (1414b) located in the middle is 1, the encoding unit (1414c) located in the next order may have an index of 3, which is increased by 2.In cases where the index increases uniformly but the rate of increase changes, such as in this case, the image decoding device (100) may determine that the current encoding unit is divided into a plurality of encoding units, including encoding units having different sizes from other encoding units. In one embodiment, if the division type mode information indicates that the current encoding unit is divided into an odd number of encoding units, the image decoding device (100) may divide the current encoding unit in such a way that the encoding unit at a predetermined position among the odd number of encoding units (e.g., the middle encoding unit) has a different size from other encoding units. In this case, the image decoding device (100) may determine the middle encoding unit having a different size by using an index (PID) for the encoding unit. However, the aforementioned index, the size or position of the encoding unit at a predetermined position to be determined, is specific for the purpose of explaining one embodiment and should not be interpreted as being limited thereto, and should be interpreted as allowing various indices, positions, and sizes of encoding units to be used.

[0174] According to one embodiment, the image decoding device (100) may use a predetermined data unit in which recursive division of the encoding unit begins.

[0175] FIG. 15 illustrates that a plurality of encoding units are determined according to a plurality of predetermined data units included in a picture according to one embodiment.

[0176] According to one embodiment, a predetermined data unit may be defined as a data unit in which the encoding unit begins to recursively divide using the division form mode information. That is, it may correspond to the highest depth encoding unit used in the process of determining multiple encoding units that divide the current picture. For convenience of explanation, such a predetermined data unit will be referred to as a reference data unit below.

[0177] According to one embodiment, the reference data unit may have a predetermined size and shape. According to one embodiment, the reference data unit may include MxN samples. Here, M and N may be the same and may be integers expressed as powers of 2. That is, the reference data unit may have a square or non-square shape and may subsequently be divided into an integer number of encoding units.

[0178] According to one embodiment, the image decoding device (100) can divide the current picture into a plurality of reference data units. According to one embodiment, the image decoding device (100) can divide the current picture into a plurality of reference data units using division form mode information for each reference data unit. This division process of reference data units may correspond to a division process using a quad-tree structure.

[0179] According to one embodiment, the image decoding device (100) can predetermine the minimum size that a reference data unit included in the current picture may have. Accordingly, the image decoding device (100) can determine reference data units of various sizes having a size greater than or equal to the minimum size, and can determine at least one encoding unit using segmentation form mode information based on the determined reference data unit.

[0180] Referring to FIG. 15, the image decoding device (100) may use a square-shaped reference encoding unit (1500) or a non-square-shaped reference encoding unit (1502). According to one embodiment, the shape and size of the reference encoding unit may be determined according to various data units (e.g., sequence, picture, slice, slice segment, tile, tile group, maximum encoding unit, etc.) that may include at least one reference encoding unit.

[0181] According to one embodiment, the bitstream acquisition unit (110) of the image decoding device (100) can acquire at least one of information regarding the shape of the reference encoding unit and information regarding the size of the reference encoding unit from the bitstream for each of the various data units. The process of determining at least one encoding unit included in the square-shaped reference encoding unit (1500) has been described in detail through the process of dividing the current encoding unit (300) of FIG. 3, and the process of determining at least one encoding unit included in the non-square-shaped reference encoding unit (1502) has been described in detail through the process of dividing the current encoding unit (400 or 450) of FIG. 4, so a detailed explanation is omitted.

[0182] According to one embodiment, the image decoding device (100) may use an index to identify the size and shape of a reference encoding unit in order to determine the size and shape of a reference encoding unit according to a portion of data units that are predetermined based on a predetermined condition. That is, the bitstream acquisition unit (110) may acquire only an index for identifying the size and shape of a reference encoding unit for each data unit (e.g., sequence, picture, slice, slice segment, tile, tile group, maximum encoding unit, etc.) among the various data units (e.g., sequence, picture, slice, slice segment, tile, tile group, maximum encoding unit, etc.) from the bitstream that satisfies a predetermined condition (e.g., a data unit having a size smaller than or equal to a slice). By using the index, the image decoding device (100) can determine the size and shape of a reference data unit for each data unit that satisfies the predetermined condition. When information regarding the form of the reference encoding unit and information regarding the size of the reference encoding unit are obtained from the bitstream for each data unit of a relatively small size and used, the utilization efficiency of the bitstream may be poor; therefore, instead of directly obtaining information regarding the form of the reference encoding unit and information regarding the size of the reference encoding unit, only the index may be obtained and used. In this case, at least one of the size and form of the reference encoding unit corresponding to the index representing the size and form of the reference encoding unit may be predetermined. That is, the image decoding device (100) can determine at least one of the size and form of the reference encoding unit included in the data unit that serves as the basis for obtaining the index by selecting at least one of the predetermined size and form of the reference encoding unit according to the index.

[0183] According to one embodiment, the image decoding device (100) may utilize at least one reference encoding unit included in one maximum encoding unit (1510). That is, the maximum encoding unit that divides the image may include at least one reference encoding unit, and the encoding unit may be determined through a recursive division process of each reference encoding unit. According to one embodiment, at least one of the width and height of the maximum encoding unit may correspond to an integer multiple of at least one of the width and height of the reference encoding unit. According to one embodiment, the size of the reference encoding unit may be the size obtained by dividing the maximum encoding unit n times according to a quad tree structure. That is, the image decoding device (100) may determine the reference encoding unit by dividing the maximum encoding unit n times according to a quad tree structure, and according to various embodiments, the reference encoding unit may be divided based on at least one of block form information and division form mode information.

[0184] According to one embodiment, the image decoding device (100) may obtain and use block form information indicating the form of the current encoding unit or division form mode information indicating a method of dividing the current encoding unit from a bitstream. The division form mode information may be included in bitstreams associated with various data units. For example, the image decoding device (100) may use the division form mode information included in a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a slice segment header, a tile header, and a tile group header. Furthermore, the image decoding device (100) may obtain and use syntax elements corresponding to the block form information or division form mode information from the bitstream for each maximum encoding unit and reference encoding unit.

[0185] A method for determining a division rule according to one embodiment of the present disclosure will be described in detail below.

[0186] The image decoding device (100) can determine the segmentation rule of the image. The segmentation rule may be predetermined between the image decoding device (100) and the image encoding device (200). The image decoding device (100) can determine the segmentation rule of the image based on information obtained from a bitstream. The image decoding device (100) can determine the segmentation rule based on information obtained from at least one of a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a slice segment header, a tile header, and a tile group header. The image decoding device (100) can determine the segmentation rule differently depending on the frame, slice, tile, temporal layer, maximum encoding unit, or encoding unit.

[0187] The image decoding device (100) can determine a partitioning rule based on the block shape of the encoding unit. The block shape may include the size, shape, ratio of width and height, and orientation of the encoding unit. The image encoding device (200) and the image decoding device (100) may predetermine to determine a partitioning rule based on the block shape of the encoding unit. However, they are not limited thereto. The image decoding device (100) can determine a partitioning rule based on information obtained from a bitstream received from the image encoding device (200).

[0188] The shape of the encoding unit may include square and non-square. If the width and height of the encoding unit are the same, the image decoder (100) may determine the shape of the encoding unit as square. Additionally, if the width and height of the encoding unit are not the same, the image decoder (100) may determine the shape of the encoding unit as non-square.

[0189] The size of the encoding unit may include various sizes such as 4x4, 8x4, 4x8, 8x8, 16x4, 16x8, ..., 256x256. The size of the encoding unit may be classified according to the length of the long side, the length of the short side, or the width of the encoding unit. The image decoding device (100) may apply the same partitioning rule to encoding units classified into the same group. For example, the image decoding device (100) may classify encoding units having the same long side length into the same size. Additionally, the image decoding device (100) may apply the same partitioning rule to encoding units having the same long side length.

[0190] The ratio of width to height of a encoding unit may include 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 32:1, or 1:32, etc. Additionally, the direction of the encoding unit may include a horizontal direction and a vertical direction. The horizontal direction may indicate a case where the width of the encoding unit is longer than the height. The vertical direction may indicate a case where the width of the encoding unit is shorter than the height.

[0191] The image decoder (100) can adaptively determine a splitting rule based on the size of the encoding unit. The image decoder (100) can determine different acceptable splitting mode types based on the size of the encoding unit. For example, the image decoder (100) can determine whether splitting is allowed based on the size of the encoding unit. The image decoder (100) can determine the splitting direction according to the size of the encoding unit. The image decoder (100) can determine an acceptable splitting type according to the size of the encoding unit.

[0192] Determining the division rule based on the size of the encoding unit may be a division rule predetermined between the image encoding device (200) and the image decoding device (100). Additionally, the image decoding device (100) may determine the division rule based on information obtained from the bitstream.

[0193] The image decoder (100) can adaptively determine a partitioning rule based on the position of the encoding unit. The image decoder (100) can adaptively determine a partitioning rule based on the position occupied by the encoding unit in the image.

[0194] Additionally, the video decoding device (100) can determine a splitting rule so that encoding units generated by different splitting paths do not have the same block shape. However, this is not limited thereto, and encoding units generated by different splitting paths may have the same block shape. Encoding units generated by different splitting paths may have different decoding processing orders. Since the decoding processing order has been explained together with FIG. 12, a detailed explanation is omitted.

[0195] FIG. 16 illustrates the encoding units that can be determined for each picture when the combination of forms in which the encoding units can be divided according to one embodiment is different for each picture.

[0196] Referring to FIG. 16, the image decoding device (100) may determine different combinations of division forms in which the encoding unit can be divided for each picture. For example, the image decoding device (100) may decode an image using a picture (1600) that can be divided into four encoding units, a picture (1610) that can be divided into two or four encoding units, and a picture (1620) that can be divided into two, three, or four encoding units among at least one picture included in the image. To divide the picture (1600) into multiple encoding units, the image decoding device (100) may use only division form information indicating that it is divided into four square encoding units. To divide the picture (1610), the image decoding device (100) may use only division form information indicating that it is divided into two or four encoding units. The image decoding device (100) may use only division form information indicating that the picture (1620) is divided into two, three, or four encoding units in order to divide the picture. Since the combination of division forms described above is merely an example for explaining the operation of the image decoding device (100), the combination of division forms described above should not be interpreted as being limited to the above example, but should be interpreted as allowing various combinations of division forms to be used for each predetermined data unit.

[0197] According to one embodiment, a bitstream acquisition unit (110) of an image decoding device (100) may acquire a bitstream containing an index representing a combination of division form information for each predetermined data unit (e.g., sequence, picture, slice, slice segment, tile, or tile group, etc.). For example, the bitstream acquisition unit (110) may acquire an index representing a combination of division form information from a sequence parameter set, a picture parameter set, a slice header, a tile header, or a tile group header. The image decoding device (100) may determine a combination of division forms in which the encoding unit can be divided for each predetermined data unit using the acquired index, and accordingly, different combinations of division forms may be used for each predetermined data unit.

[0198] FIG. 17 illustrates various forms of encoding units that can be determined based on partitioned form mode information that can be expressed as binary code according to one embodiment.

[0199] According to one embodiment, the image decoding device (100) can divide the encoding unit into various forms using block form information and division form mode information obtained through the bitstream acquisition unit (110). The forms of the encoding unit that can be divided may correspond to various forms including the forms described through the embodiments above.

[0200] Referring to FIG. 17, the image decoding device (100) can divide a square-shaped encoding unit into at least one of a horizontal direction and a vertical direction based on the divided shape mode information, and can divide a non-square-shaped encoding unit into a horizontal direction or a vertical direction.

[0201] According to one embodiment, if the image decoding device (100) can divide a square-shaped encoding unit into four square encoding units by dividing it in the horizontal and vertical directions, there may be four types of division forms that can be represented by the division form mode information for the square encoding unit. According to one embodiment, the division form mode information may be expressed as a 2-digit binary code, and a binary code may be assigned to each division form. For example, if the encoding unit is not divided, the division form mode information may be expressed as (00)b; if the encoding unit is divided in the horizontal and vertical directions, the division form mode information may be expressed as (01)b; if the encoding unit is divided in the horizontal direction, the division form mode information may be expressed as (10)b; and if the encoding unit is divided in the vertical direction, the division form mode information may be expressed as (11)b.

[0202] According to one embodiment, when the image decoding device (100) divides a non-square-shaped encoding unit in a horizontal or vertical direction, the type of division form that can be represented by the division form mode information may be determined by how many encoding units are divided. Referring to FIG. 17, according to one embodiment, the image decoding device (100) may divide a non-square-shaped encoding unit into up to three. The image decoding device (100) may divide the encoding unit into two encoding units, in which case the division form mode information may be expressed as (10)b. The image decoding device (100) may divide the encoding unit into three encoding units, in which case the division form mode information may be expressed as (11)b. The image decoding device (100) may decide not to divide the encoding unit, in which case the division form mode information may be expressed as (0)b. That is, the image decoding device (100) can use variable length coding (VLC) rather than fixed length coding (FLC) to use binary code representing segmented form mode information.

[0203] Referring to FIG. 17 according to one embodiment, the binary code of the division type mode information indicating that the encoding unit is not divided can be represented as (0)b. If the binary code of the division type mode information indicating that the encoding unit is not divided is set to (00)b, then all 2 bits of the binary code of the division type mode information must be used even though there is no division type mode information set to (01)b. However, as illustrated in FIG. 17, if three division types for a non-square encoding unit are used, the image decoding device (100) can determine that the encoding unit is not divided even if a 1-bit binary code (0)b is used as the division type mode information, thus allowing for efficient use of the bitstream. However, the division type of the non-square encoding unit indicated by the division type mode information should not be interpreted as being limited only to the three types illustrated in FIG. 17, but should be interpreted as various types including the embodiments described above.

[0204] FIG. 18 illustrates another form of encoding unit that can be determined based on partitioned form mode information that can be represented as binary code according to one embodiment.

[0205] Referring to FIG. 18, the image decoding device (100) can divide a square-shaped encoding unit in a horizontal or vertical direction based on the division shape mode information, and can divide a non-square-shaped encoding unit in a horizontal or vertical direction. That is, the division shape mode information can indicate that a square-shaped encoding unit is divided in one direction. In this case, the binary code of the division shape mode information indicating that the square-shaped encoding unit is not divided can be represented as (0)b. If the binary code of the division shape mode information indicating that the encoding unit is not divided is set to (00)b, then all 2 bits of the binary code of the division shape mode information must be used even though there is no division shape mode information set to (01)b. However, as illustrated in FIG. 18, if three division forms for a square-shaped encoding unit are used, the image decoding device (100) can determine that the encoding unit is not divided even if a 1-bit binary code (0)b is used as division form mode information, thus allowing the bitstream to be used efficiently. However, the division form of the square-shaped encoding unit indicated by the division form mode information should not be interpreted as being limited only to the three forms illustrated in FIG. 18, but should be interpreted as various forms including the embodiments described above.

[0206] According to one embodiment, block form information or partition form mode information can be represented using binary code, and such information can be immediately generated as a bitstream. Additionally, block form information or partition form mode information that can be represented by binary code may not be immediately generated as a bitstream but may be used as binary code input in CABAC (context adaptive binary arithmetic coding).

[0207] According to one embodiment, the image decoding device (100) describes a process of obtaining syntax for block form information or partition form mode information through CABAC. A bitstream containing a binary code for the syntax can be obtained through a bitstream acquisition unit (110). The image decoding device (100) can detect a syntax element representing block form information or partition form mode information by debinding a bin string included in the obtained bitstream. According to one embodiment, the image decoding device (100) obtains a set of binary bin strings corresponding to the syntax element to be decoded, and can decode each bin using probability information, and the image decoding device (100) can repeat this process until the bin string composed of these decoded bins becomes equal to one of the previously obtained bin strings. The image decoding device (100) can determine the syntax element by performing debinding of the bin string.

[0208] According to one embodiment, the image decoding device (100) can determine the syntax for a bin string by performing a decoding process of adaptive binary arithmetic coding, and the image decoding device (100) can update a probability model for the bins obtained through a bitstream acquisition unit (110). Referring to FIG. 17, the bitstream acquisition unit (110) of the image decoding device (100) can obtain a bitstream representing a binary code representing partitioned mode information according to one embodiment. Using the obtained binary code having a size of 1 bit or 2 bits, the image decoding device (100) can determine the syntax for the partitioned mode information. To determine the syntax for the partitioned mode information, the image decoding device (100) can update the probability for each bit of the 2-bit binary code. That is, the image decoding device (100) can update the probability of having a value of 0 or 1 when decoding the next bin, depending on whether the value of the first bin of the 2-bit binary code is 0 or 1.

[0209] According to one embodiment, the image decoding device (100) can update the probability for the bins used in the process of decoding the bins of the empty string for the syntax during the process of determining the syntax, and the image decoding device (100) can determine that the probability is not updated for certain bits of the empty string and has the same probability.

[0210] Referring to FIG. 17, in the process of determining syntax using an empty string representing segmentation mode information for a non-square type encoding unit, the image decoder (100) can determine syntax for the segmentation mode information using one bin having a value of 0 when the non-square type encoding unit is not segmented. That is, when block type information indicates that the current encoding unit is a non-square type, the first bin of the empty string for the segmentation mode information may be 0 when the non-square type encoding unit is not segmented, and 1 when it is segmented into two or three encoding units. Accordingly, the probability that the first bin of the empty string for the segmentation mode information for a non-square type encoding unit is 0 may be 1 / 3, and the probability that it is 1 may be 2 / 3. As described above, since the image decoding device (100) can represent only a 1-bit empty string having a value of 0 as the segmentation mode information indicating that a non-square type encoding unit is not segmented, the image decoding device (100) can determine the syntax for the segmentation mode information by determining whether the second bin is 0 or 1 only when the first bin of the segmentation mode information is 1. According to one embodiment, the image decoding device (100) can decode the bin by considering that when the first bin of the segmentation mode information is 1, the probability that the second bin is 0 or 1 is equal to the probability.

[0211] According to one embodiment, the image decoding device (100) may use various probabilities for each bin in the process of determining the bins of the bin string for the segmented form mode information. According to one embodiment, the image decoding device (100) may determine the probability of the bins for the segmented form mode information differently depending on the direction of the non-square block. According to one embodiment, the image decoding device (100) may determine the probability of the bins for the segmented form mode information differently depending on the width or the length of the long side of the current encoding unit. According to one embodiment, the image decoding device (100) may determine the probability of the bins for the segmented form mode information differently depending on at least one of the shape of the current encoding unit and the length of the long side.

[0212] According to one embodiment, the image decoding device (100) may determine that the probability of bins for segmented form mode information is the same for encoding units of a predetermined size or larger. For example, based on the length of the long side of the encoding unit, the probability of bins for segmented form mode information is determined to be the same for encoding units of a size of 64 samples or larger.

[0213] According to one embodiment, the image decoding device (100) may determine the initial probability for the bins constituting the empty string of the segmented form mode information based on the slice type (e.g., I slice, P slice, or B slice).

[0214] Figure 19 is a block diagram of an image encoding and decoding system that performs in-loop filtering.

[0215] The encoding unit (1910) of the video encoding and decoding system (1900) transmits an encoded bitstream of the video, and the decoding unit (1950) receives the bitstream and decodes it to output a restored video. Here, the encoding unit (1910) may have a configuration similar to the video encoding device (200) described later, and the decoding unit (1950) may have a configuration similar to the video decoding device (100).

[0216] In the encoding unit (1910), the prediction encoding unit (1915) outputs prediction data through inter-prediction and intra-prediction, and the transformation and quantization unit (1920) outputs quantized transformation coefficients of residual data between the prediction data and the current input image. The entropy encoding unit (1925) encodes and transforms the quantized transformation coefficients and outputs them as a bitstream. The quantized transformation coefficients are restored into spatial domain data through the inverse quantization and inverse transformation unit (1930), and the restored spatial domain data is output as a restored image through the in-loop filtering unit (1940). The restored image can be used as a reference image for the next input image after passing through the prediction encoding unit (1915).

[0217] The encoded image data among the bitstreams received by the decoding unit (1950) is restored into spatial domain residual data through the entropy decoding unit (1955) and the inverse quantization and inverse transform unit (1960). The predicted data and residual data output from the prediction decoding unit (1975) are combined to form spatial domain image data, and the in-loop filtering unit (1970) can output a restored image for the current original image by performing filtering on the spatial domain image data. The restored image can be used as a reference image for the next original image by the prediction decoding unit (1975).

[0218] The in-loop filtering unit (1940) of the encoding unit (1910) performs in-loop filtering using filter information input according to user input or system settings. The filter information used by the in-loop filtering unit (1940) is output to the entropy encoding unit (1925) and transmitted to the decoding unit (1950) along with the encoded image data. The in-loop filtering unit (1970) of the decoding unit (1950) can perform in-loop filtering based on the filter information input from the decoding unit (1950).

[0219] The various embodiments described above explain the operation related to the image decoding method performed by the image decoding device (100). Below, the operation of the image encoding device (200) that performs an image encoding method corresponding to the reverse process of the image decoding method will be explained through various embodiments.

[0220] FIG. 2 illustrates a block diagram of an image encoding device (200) capable of encoding an image based on at least one of block shape information and segmented shape mode information according to one embodiment.

[0221] The video encoding device (200) may include an encoding unit (220) and a bitstream generation unit (210). The encoding unit (220) may receive an input video and encode the input video. The encoding unit (220) may encode the input video to obtain at least one syntax element. The syntax element may include at least one of a skip flag, a prediction mode, a motion vector difference, a motion vector prediction method (or index), a transform quantized coefficient, a coded block pattern, a coded block flag, an intra prediction mode, a direct flag, a merge flag, a delta QP, a reference index, a prediction direction, and a transform index. The encoding unit (220) may determine a context model based on block shape information including at least one of the shape, direction, width, and height ratio or size of the encoding unit.

[0222] The bitstream generation unit (210) can generate a bitstream based on the encoded input image. For example, the bitstream generation unit (210) can generate a bitstream by entropy encoding syntax elements based on a context model. Additionally, the image encoding device (200) can transmit the bitstream to the image decoding device (100).

[0223] According to one embodiment, the encoding unit (220) of the image encoding device (200) can determine the shape of the encoding unit. For example, the encoding unit may be square or non-square in shape, and information indicating such shape may be included in block shape information.

[0224] According to one embodiment, the encoding unit (220) can determine how the encoding unit will be divided. The encoding unit (220) can determine the form of at least one encoding unit included in the encoding unit, and the bitstream generation unit (210) can generate a bitstream including division form mode information that includes information about the form of such encoding unit.

[0225] According to one embodiment, the encoding unit (220) may determine whether the encoding unit is divided or not. If the encoding unit (220) determines that only one encoding unit is included in the encoding unit or that the encoding unit is not divided, the bitstream generation unit (210) may generate a bitstream including division type mode information indicating that the encoding unit is not divided. Additionally, the encoding unit (220) may divide the encoding unit into a plurality of encoding units, and the bitstream generation unit (210) may generate a bitstream including division type mode information indicating that the encoding unit is divided into a plurality of encoding units.

[0226] According to one embodiment, information indicating how many encoding units to divide or in which direction to divide may be included in the division type mode information. For example, the division type mode information may indicate dividing in at least one of the vertical direction and the horizontal direction, or not dividing.

[0227] The video encoding device (200) determines information regarding the segmentation mode based on the segmentation mode of the encoding unit. The video encoding device (200) determines a context model based on at least one of the ratio or size of the shape, direction, width, and height of the encoding unit. Then, the video encoding device (200) generates information regarding the segmentation mode for segmenting the encoding unit based on the context model as a bitstream.

[0228] The video encoding device (200) may obtain an array for matching at least one of the ratio or size of the shape, direction, width, and height of an encoding unit with an index for the context model in order to determine the context model. The video encoding device (200) may obtain an index for the context model based on at least one of the ratio or size of the shape, direction, width, and height of an encoding unit in the array. The video encoding device (200) may determine the context model based on the index for the context model.

[0229] The video encoding device (200) may determine a context model based further on block shape information including at least one of the ratio or size of the shape, direction, width, and height of a surrounding encoding unit adjacent to the encoding unit, in order to determine the context model. Additionally, the surrounding encoding unit may include at least one of the encoding units located on the lower left, left, upper left, upper, upper right, right, or lower right side of the encoding unit.

[0230] Additionally, the video encoding device (200) can compare the width of an upper peripheral encoding unit with the width of an encoding unit in order to determine a context model. Additionally, the video encoding device (200) can compare the height of left and right peripheral encoding units with the height of an encoding unit. Additionally, the video encoding device (200) can determine a context model based on the comparison results.

[0231] The operation of the video encoding device (200) includes content similar to the operation of the video decoding device (100) described in FIGS. 3 to 19, so a detailed description is omitted.

[0232] FIG. 20 is a block diagram illustrating the configuration of image decoding according to one embodiment.

[0233] Referring to FIG. 20, the image decoding device (2000) may include a memory (2010) and a processor (2030).

[0234] In one embodiment of the present disclosure, the memory (2010) and the processor (2030) of the present disclosure may each be implemented as at least one memory and at least one processor. In one embodiment of the present disclosure, when instructions are stored in the memory (2010), the operation of the bitstream acquisition unit (110), the decoder (120) illustrated in FIG. 1, and the entropy decoder (1955), the inverse quantization and inverse transformation unit (1960), the in-loop filtering unit (1970), and the prediction decoder (1975) illustrated in FIG. 19 may be implemented according to the instructions called by at least one process.

[0235] In one embodiment of the present disclosure, the image decoding device (2000) may include a storage medium that stores at least one of the bitstream acquisition unit (110) and decoding unit (120) shown in FIG. 1, and the entropy decoding unit (1955), inverse quantization and inverse transformation unit (1960), in-loop filtering unit (1970), and prediction decoding unit (1975) shown in FIG. 19. The storage medium may be included in a memory (2010) or may be a storage medium different from the memory (2010).

[0236] Additionally, the video decoding device (2000) may include a storage medium control unit that controls the data input and output of the storage medium. The storage medium control unit may be included in the processor (2030), or it may be a control unit different from the processor (2030).

[0237] In one embodiment of the present disclosure, the image decoding device (2000) can obtain a bitstream generated as a result of encoding an image.

[0238] In one embodiment of the present disclosure, the bitstream may include encoded data generated by encoding for the current block. The encoded data included in the bitstream may be used to restore the current block. The current block may be a maximum encoding unit, encoding unit, transform unit, or prediction unit divided from the current image to be decoded.

[0239] In one embodiment of the present disclosure, the image decoding device (2000) can determine the current block based on information associated with a block included in a bitstream corresponding to at least one level of a sequence parameter set, a picture parameter set, a video parameter set, a slice header, and a slice segment header, and / or information about a block partitioning mode.

[0240] In one embodiment of the present disclosure, the image decoding device (2000) can receive a bitstream from the image encoding device through a network.

[0241] In one embodiment of the present disclosure, the image decoding device (2000) can obtain a bitstream from a data storage medium including a magnetic medium such as a hard disk, a floppy disk and a magnetic tape, an optical recording medium such as a CD-ROM and a DVD, a magneto-optical medium such as a floptical disk, etc.

[0242] In one embodiment of the present disclosure, an image decoding device (2000) may obtain syntax elements for decoding an image from a bitstream. Values ​​corresponding to the syntax elements may be included in the bitstream according to the hierarchical structure of the image.

[0243] In one embodiment of the present disclosure, an image decoding device (2000) can parse bits included in a bitstream to obtain bins of syntax elements. The parsing process may include at least one of entropy decoding and inverse binary conversion processes.

[0244] In one embodiment of the present disclosure, the bitstream may include information regarding the prediction mode of the current block within the current image. The current block may include at least one of a maximum encoding unit, an encoding unit, a transform unit, and a prediction unit divided from the current image to be decoded. In one embodiment of the present disclosure, as the prediction mode of the current block, a prediction mode such as an intra mode, an inter mode, an intra block copy mode, and / or a palette mode may be used.

[0245] In one embodiment of the present disclosure, the intra mode is an operation that predicts a block based on spatial similarity, and is a mode that predicts or restores the current block based on spatial similarity within the current image, and the inter mode is a mode that predicts or restores the current block based on a reference image to reduce temporal redundancy between images. The intra block copy mode is a mode that predicts the current block by copying the block pointed to by the block vector, and may be referred to as the IBC mode. The intra block copy mode may include the IBC Merge mode, the IBC AMVP (Advanced Motion Vector Prediction) mode, the IBC-TM (Template Matching) Merge mode, and / or the IBC-TM AMVP mode. The palette mode may be a mode that limits the number of colors within the current block and represents them through a palette color index, and predicts the current block through the palette color index.

[0246] In one embodiment of the present disclosure, the image decoder (2000) can obtain information about the prediction mode of the current block from the bitstream. For example, the image decoder (2000) can obtain an index indicating the prediction mode of the current block from the bitstream.

[0247] In one embodiment of the present disclosure, the image decoding device (2000) can generate a prediction block of the current block by performing a prediction on the current block according to the prediction mode of the current block, and can restore the current block using the prediction block.

[0248] In one embodiment of the present disclosure, information regarding the prediction mode of the current block may be included in the sequence parameter set, picture parameter set, slice header, or slice data of the bitstream.

[0249] In one embodiment of the present disclosure, the bitstream may include information regarding quantization parameters of a current block within the current image. The information regarding quantization parameters may include information for determining quantization parameters for a luminance component and / or quantization parameters for a chroma component. Quantization parameters may be determined per slice or maximum encoding block (or unit).

[0250] In one embodiment of the present disclosure, the image decoding device (2000) may perform in-loop filtering through an in-loop filtering unit (1970). In-loop filtering may be a filtering operation that performs at least one of deblocking filtering using a deblocking filter, SAO filtering using a Sample Adaptive Offset (SAO) filter, bilateral filtering using a bilateral filter, and ALF filtering using an Adaptive Loop Filter (ALF) on a restored block in the current image. Meanwhile, SAO filtering may be referred to as Sample Adaptive Offset filtering, and ALF filtering may be referred to as Adaptive Loop filtering.

[0251] In one embodiment of the present disclosure, the image decoder (2000) may perform deblocking filtering. Deblocking filtering may be an operation that improves image quality by smoothing the boundaries between blocks. The image decoder (2000) may perform filtering on samples of the current block where deblocking filtering has been performed using a Sample Adaptive Offset (SAO) filter and / or a Bilateral Filter (BIF). The SAO filter and BIF can improve image quality by reducing the error between the restored image and the original image. The SAO filter and BIF may perform filtering on a sample basis. The image decoder (2000) may perform filtering using an Adaptive Loop Filter (ALF). The ALF can improve image quality by reducing the error between the restored image and the original image. The ALF may perform filtering on a block basis. Meanwhile, the filtering operation through the deblocking filter, SAO filter, BIF, and / or adaptive loop filter in the video decoding device (2000) may be an operation performed in the in-loop filtering unit (1970).

[0252] In one embodiment of the present disclosure, the image decoder (2000) may obtain information from the bitstream regarding whether to perform deblocking filtering within in-loop filtering, sample adaptive offset filtering, bidirectional filtering, and / or adaptive loop filtering. For example, the image decoder (2000) may obtain information from the bitstream regarding whether to perform bidirectional filtering within in-loop filtering. Based on the information obtained from the bitstream regarding whether to perform bidirectional filtering within in-loop filtering, the image decoder (2000) may decide to perform bidirectional filtering for the current block.

[0253] Accordingly, in one embodiment of the present disclosure, the image decoding device (2000) proposes a method and device for further improving image quality by performing bidirectional filtering using various parameters.

[0254] Below, with reference to Fig. 21, we will explain in detail the in-loop filtering.

[0255] FIG. 21 is a block diagram showing the configuration of an in-loop filtering unit according to one embodiment of the present disclosure.

[0256] Referring to FIG. 21, the in-loop filtering unit (1970) can generate a filtered block by performing filtering on the restored block in the current image. In one embodiment of the present disclosure, the in-loop filtering unit (1970) may include a deblocking filtering unit (2110), a sample adaptive offset filtering unit (2120), a bidirectional filtering unit (2130), and an adaptive loop filtering unit (2140).

[0257] In one embodiment of the present disclosure, the image decoding device (2000) may perform deblocking filtering on a current block in a current image through a deblocking filtering unit (2110). The deblocking filtering may be a filtering that modifies the values ​​of a plurality of samples near the boundary between the current block and surrounding blocks in order to reduce blocking artifacts that occur during the process of performing transformation, prediction, and quantization. The image decoding device (2000) may modify the values ​​of the samples by applying deblocking filter coefficients to samples near the boundary of the current block and samples near the boundary of surrounding blocks through deblocking filtering.

[0258] In one embodiment of the present disclosure, the image decoder (2000) may perform sample adaptive offset filtering through the sample adaptive offset filtering unit (2120). The image decoder (2000) may obtain an SAO offset value for the current sample within the current block ( ) can be determined. The image decoder (2000) can determine whether the type of sample adaptive offset of the current block is an edge offset or a band offset, and depending on the determined type of sample adaptive offset, the SAO offset value ( ) can be determined. Meanwhile, sample adaptive offset filtering may include cross-component sample adaptive offset filtering (CC-SAO). The type of cross-component sample adaptive offset may include only band offset, and may be a filtering method similar to sample adaptive offset except that it uses all Y, U, and V color components. The image decoder (2000) performs cross-component sample adaptive offset filtering through the sample adaptive offset filtering unit (2120), thereby obtaining a CC-SAO offset value ( It may also decide on ).

[0259] In one embodiment of the present disclosure, an image decoder (2000) may obtain an edge offset class from a bitstream. The edge offset class may represent a representative edge among a horizontal edge, a vertical edge, a 135-degree edge, or a 45-degree edge. The image decoder (2000) may determine an edge offset category based on a category condition. The category condition may include a magnitude condition between the values ​​of samples at a location determined based on the edge offset class. The image decoder (2000) may determine an SAO offset value for the current sample based on the edge offset category.

[0260] In one embodiment of the present disclosure, the image decoder (2000) may determine a plurality of bands according to the brightness of the pixels. The image decoder (2000) may obtain offset values ​​corresponding to the plurality of bands from a bitstream. The plurality of bands may include continuous bands. The image decoder (2000) may determine a band corresponding to the current sample. The image decoder (2000) may determine an offset value corresponding to the determined band as an SAO offset value for the current sample.

[0261] In one embodiment of the present disclosure, the image decoder (2000) can perform filtering on the current sample using surrounding samples of the current sample through a bidirectional filtering unit (2130). The image decoder (2000) can perform filtering on samples of the luminance component and samples of the chroma component through a bidirectional filtering unit (2130). The image decoder (2000) has a BIF offset value ( ) can be determined. The BIF offset value may include the amount of change of the current sample due to filtering. The image decoder (2000) may determine the filtering strength based on the difference value between the current sample and surrounding samples. For example, the image decoder (2000) may apply stronger filtering as the difference between the current sample and surrounding samples increases. A bidirectional filter according to one embodiment of the present disclosure is described in detail with reference to FIGS. 22 to 31.

[0262] In one embodiment of the present disclosure, the image decoding device (2000) can determine an in-loop filtered current sample using an SAO offset value determined by a sample adaptive offset filtering unit (2120) and a BIF offset value determined by a bidirectional filtering unit (2130). For example, the filtered current sample can be determined using the sum of the restored current sample, the BIF offset value, and the SAO offset value. Meanwhile, the filtered current sample cannot be greater than the bit depth of the image.

[0263] In one embodiment of the present disclosure, the image decoder (2000) can determine filter coefficients that minimize the error between the original image and the restored image through an adaptive loop filtering unit (2140). The image decoder (2000) can determine filter coefficients based on the characteristics of the current block. For example, the image decoder (2000) can determine the class of an N x N block through an adaptive loop filtering unit (2140) and determine filter coefficients based on the class. The class of the block can be determined based on the direction and activity of pixels within the block. The adaptive loop filtering unit (2140) can perform geometric transformations on the filter based on the slope within the block. The slope within the block may include a horizontal slope, a vertical slope, and two diagonal slopes. The geometric transformation may include at least one of a diagonal symmetry transformation, a vertical symmetry transformation, or a rotation transformation. The image decoder (2000) can perform filtering using filter coefficients. The adaptive loop image decoder (2000) can perform filtering by applying filter coefficients to the difference between the values ​​of the current sample and surrounding samples.

[0264] In one embodiment of the present disclosure, the in-loop filtering unit (1970) may not include at least some of the deblocking filtering unit (2110), the sample adaptive offset filtering unit (2120), the bidirectional filtering unit (2130), and the adaptive loop filtering unit (2140). For example, in-loop filtering for a restored block corresponding to the current block may be performed only by bidirectional filtering by the bidirectional filtering unit (2130). The image decoder (2000) may obtain from the bitstream whether the deblocking filtering unit (2110), the sample adaptive offset filtering unit (2120), the bidirectional filtering unit (2130), and the adaptive loop filtering unit (2140) perform filtering. Whether the bidirectional filtering unit (2130) performs filtering may be determined using Rate Distortion Optimization (RDO). In other words, whether to perform bidirectional filtering can be determined through an optimization process using the image quality and the number of bits included in the bitstream.

[0265] In one embodiment of the present disclosure, when the image decoding device (2000) performs in-loop filtering according to the order shown in FIG. 21, it may obtain an output sample according to Equation 1 based on inputting an input sample (2105) to an in-loop filtering unit. The input sample (2105) may be a sample included in a restoration block within the current image as a sample input to the in-loop filtering.

[0266] [Mathematical Formula 1]

[0267]

[0268] If we look at mathematical formula 1, is input sample (2105), is the SAO offset value output from the sample adaptive offset filtering unit (2120), is the CC-SAO (Cross-Component Sample Adaptive Offset) offset value output from the sample adaptive offset filtering unit (2120), can represent the BIF offset value output from the bidirectional filtering unit (2130). According to Equation 1, the image decoder (2000) can obtain an output sample by clipping the sum of the sample value of the input sample (2105), the SAO offset value, the CC-SAO offset value, and the BIF offset value. The image decoder (2000) can input the output sample to the adaptive loop filtering unit (2140), and the output (2145) of the adaptive loop filtering unit (2140) can be the output of the in-loop filtering unit. The image decoder (2000) can obtain an in-loop filtered sample through adaptive loop filtering.

[0269] In one embodiment of the present disclosure, the image decoder (2000) may obtain information indicating whether to perform filtering on the bitstream. The image decoder (2000) may perform filtering based on the obtained information. Meanwhile, the order of in-loop filtering operations is not limited to the example disclosed in FIG. 21, and bidirectional filtering and sample adaptive offset filtering may be performed sequentially rather than in parallel.

[0270] In one embodiment of the present disclosure, the in-loop filtering unit (1970) of the decoding unit of FIG. 19 may be configured as in FIG. 21 and may be configured to be identical to the in-loop filtering unit (1940) of the encoding unit of FIG. 19.

[0271] FIG. 22 is a drawing for explaining the shape of a bidirectional filter according to one embodiment of the present disclosure.

[0272] Referring to FIG. 22, the bidirectional filter (2200) may be a 5 x 5 diamond-shaped filter. However, not limited thereto, the bidirectional filter may be an N x N diamond-shaped filter such as a 3 x 3 or 7 x 7 filter.

[0273] A bidirectional filter (2200) according to one embodiment of the present disclosure may include a current sample (2210) and surrounding samples. The current sample (2210) may refer to a central sample (IC) on which filtering is performed. The surrounding samples may include an upper sample (IA) located above the current sample (2210), a left sample (IL) located to the left of the current sample (2210), a lower sample (IB) located below the current sample (2210), and a right sample (IR) located to the right of the current sample (2210). The surrounding samples may include a NorthWest sample (INW) located on the upper left side of the current sample (2210), a SouthWest sample (ISW) located on the lower left side of the current sample (2210), a SouthEast sample (ISE) located on the lower right side of the current sample (2210), and a NorthEast sample (INE) located on the upper right side of the current sample (2210). The surrounding samples may include an above-above sample (IAA) located on the upper side of the upper sample, a left-left sample (ILL) located on the left side of the left sample, a below-below sample (IBB) located on the lower side of the lower sample, and a right-right sample (IRR) located on the right side of the right sample.

[0274] In one embodiment of the present disclosure, the image decoding device (2000) can determine a BIF offset value using the difference value between the current sample (2210) and surrounding samples. For example, the BIF offset value for the current sample (2210) can be determined as shown in Equation 2 below.

[0275] [Mathematical Formula 2]

[0276]

[0277] Here, is a scale factor that determines the filtering strength, and represents the absolute value of the input, and is a function that returns the sign of the input, and k in this case may be a parameter representing the position of any one of the surrounding samples. It can represent a function using a predefined look-up table (LUT).

[0278] In one embodiment of the present disclosure, the image decoding device (2000) can determine an offset value using the difference value between the current sample (2210) and surrounding samples. Meanwhile, the current sample (2210) ( ) can be referred to as the first sample included in the current block, and one of the surrounding samples of the first sample, which is the current sample (2210) ( ) can be referred to as the second sample. The image decoding device (2000) can determine an offset by applying the difference between the first sample value corresponding to the first sample and the second sample value corresponding to the second sample to a predefined lookup table.

[0279] In one embodiment of the present disclosure, the image decoding device (2000) may obtain a predefined lookup table. The lookup table may include a plurality of indices and a plurality of values ​​corresponding to each of the plurality of indices. For example, the lookup table may include 16 values ​​such as {0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}. LUT[i] represents the value corresponding to index i, and LUT[0] represents 0, which is the 0th value of the lookup table, that is, the value located at the far left. Meanwhile, for convenience of explanation, the case in which the index for determining a predetermined value of the lookup table is one-dimensional has been described as an example; however, the predetermined value of the lookup table may be determined by a two-dimensional index, not limited to the disclosed example.

[0280] In one embodiment of the present disclosure, a lookup table may be determined based on a quantization parameter. The lookup table may be determined according to the prediction mode of the current block. Meanwhile, the quantization parameter may be a value determined by the quantization parameter information of the slice to which the current block belongs, and the current block may be a block representing a coding unit.

[0281] In one embodiment of the present disclosure, the image decoding device (2000) may determine a scale factor that determines the filtering strength. Scale factor that determines the filtering strength may be a value determined according to the following mathematical formulas 3 to 5.

[0282] [Mathematical Formula 3]

[0283]

[0284] [Mathematical Formula 4]

[0285]

[0286] [Mathematical Formula 5]

[0287]

[0288] In one embodiment of the present disclosure, the image decoding device (2000) can determine the first subscale factor by using a lookup table for the first subscale factor. The first subscale factor is may be a value determined by a lookup table that uses an index based on the height and / or width of the prediction block corresponding to the current block.

[0289] In one embodiment of the present disclosure, the image decoding device (2000) may determine the second subscale factor by using a lookup table for the second subscale factor. The second subscale factor is may be a value determined by a lookup table that uses an index based on the Mean Absolute Difference (MAD) information of the predicted block corresponding to the current block.

[0290] In one embodiment of the present disclosure, the image decoding device (2000) sums a first subscale factor and a second subscale factor to determine a scale factor for determining the filtering strength. can decide.

[0291] Meanwhile, the MAD information for a given block may be a value determined according to mathematical formula 6.

[0292] [Mathematical Formula 6]

[0293]

[0294] Hereinafter, we will examine a function for determining an offset for bidirectional filtering according to one embodiment of the present disclosure through FIGS. 23 to 27.

[0295] FIG. 23 is a drawing showing a graph for determining an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0296] In one embodiment of the present disclosure, of Equation 2 It may include a function using a predefined Look-Up Table (LUT). For the luminance component can be determined according to mathematical formula 7, and regarding the chroma component It can be determined according to mathematical formula 8.

[0297] [Mathematical Formula 7]

[0298]

[0299] [Mathematical Formula 8]

[0300]

[0301] Referring to FIG. 23, if we examine mathematical equations 7 and 8, is in the preceding opening It can be the difference value between the current sample and surrounding samples expressed as. is the first sample included in the current block ( It can be referred to as the difference between the first sample value corresponding to ) and the second sample value corresponding to the second sample, which is one of the surrounding samples of the first sample. It can represent a lookup table based on the difference value between the current sample and surrounding samples and quantization parameters.

[0302] In one embodiment of the present disclosure, FIG. 23 is a lookup table in Equations 7 and 8 Cannibalism in the underwear , , , and A graph (2300) representing a function for can be illustrated. Among the functions included in the lookup tables of Equation 7 and Equation 8 of FIG. 23, is the first function, is the second function, is the third function, can be referred to as the fourth function.

[0303] In one embodiment of the present disclosure, the first and second functions included in Equation 7 are functions for the lumens component and may be functions in which the absolute value of the difference between the first sample value and the second sample value is clipped to [0, 118]. The third and fourth functions included in Equation 8 are functions for the chroma component and may be functions in which the absolute value of the difference between the first sample value and the second sample value is clipped to [0, 59].

[0304] In one embodiment of the present disclosure, the first to fourth functions are designed to be changeable by various parameters, thereby enabling bidirectional filtering that is more suitable for the current block. Hereinafter, an example of designing the first to fourth functions to be changeable by various parameters will be explained through FIGS. 25 to 31.

[0305] FIG. 24 is a drawing showing a graph used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0306] In one embodiment of the present disclosure, a lookup table may be determined based on a quantization parameter. FIG. 24 may be a graph (2400) of a lookup table included in Equations 7 and 8, illustrated according to the quantization parameter. For example, the graph (2400) of FIG. 24 may include a graph of a function for a lookup table for cases where the values ​​of the quantization parameter are 17, 21, 25, 29, 33, 37, and 41. For convenience of explanation, a graph including only a function for some quantization parameters is illustrated, and the values ​​of the quantization parameter may vary.

[0307] In one embodiment of the present disclosure, referring to FIG. 24, the image decoder (2000) can obtain an offset for high bidirectional filtering according to Equations 2 to 8 as the quantization parameter of the current block is larger. The image decoder (2000) can obtain an offset for low bidirectional filtering as the quantization parameter of the current block is smaller. Meanwhile, the image decoder (2000) obtaining an offset for high bidirectional filtering may be referred to as strong filtering being performed, and obtaining an offset for low bidirectional filtering may be referred to as weak filtering being performed.

[0308] In one embodiment of the present disclosure, referring to FIG. 24, the image decoding device (2000) can obtain an offset for high bidirectional filtering when the function values ​​of the first to fourth functions fall within the intermediate range of 0 to 15. For example, for the same quantization parameter, the image decoding device (2000) can obtain a larger lookup table value when the function value of the first to fourth functions is 6 than when the function value is 0. The image decoding device (2000) can obtain an offset for high bidirectional filtering as the lookup table value increases. Meanwhile, for convenience of explanation, only graphs for cases where the quantization parameter values ​​are 17, 21, 25, 29, 33, 37, and 41 are shown, but the quantization parameter values ​​may be any one of 17 to 42 and are not limited to the disclosed examples.

[0309] FIG. 25 is a graph showing a graph used to determine an offset for bidirectional filtering of a luma component according to one embodiment of the present disclosure.

[0310] In one embodiment of the present disclosure, the first and second functions of FIG. 23 are designed to be changeable by various parameters, thereby enabling bidirectional filtering that is more suitable for the current block.

[0311] In one embodiment of the present disclosure, of FIG. 23 The first function and The second function It can be expressed in the form of a function. For example, In this case, the first function is the case where c=4 and k=8, and the second function may be the case where c=4 and k=24.

[0312] In one embodiment of the present disclosure, the image decoding device (2000) uses a first function and a second function to determine an offset for bidirectional filtering. It can be redesigned as such. Meanwhile, c may be a parameter determined based on various information associated with the current block, and c may be a parameter used to determine an offset for bidirectional filtering, as a parameter to be applied to the difference between the first sample value and the second sample value. k may be a constant pre-set in the image encoding device or image decoding device (2000).

[0313] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on information associated with the current block. The image decoding device (2000) may determine a parameter to apply to a value of d, which is the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is a peripheral sample of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block. Meanwhile, the prediction block corresponding to the current block may be a prediction block including a first sample.

[0314] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the fact that the prediction mode of the current block is one of an inter mode, an intra mode, an intra block copy mode, and a palette mode. For example, the image decoding device (2000) may distinguish the prediction modes of the current block and use the parameter to apply to the difference between the first sample value and the second sample value according to each prediction mode and the quantization parameter to apply to the lookup table as an index of the lookup table. Meanwhile, the quantization parameter to apply to the lookup table may be determined or obtained indirectly by obtaining the amount of change of the quantization parameter to apply to the lookup table.

[0315] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on at least one of the height of a prediction block and the width of a prediction block. For example, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the smaller value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the larger value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the height of a prediction block and the width of a prediction block. For example, the image decoding device (2000) can use another lookup table index by applying a logarithmic function to the height and / or width of the prediction block and then clipping to a value between 0 and 5 to divide the height and / or width into 6 parts each, thereby obtaining a parameter to apply to the difference between the first sample value and the second sample value according to the height and / or width of the prediction block and a quantization parameter to apply to the lookup table.

[0316] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a larger value as the size of the prediction block is smaller. The image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a smaller value as the size of the prediction block is larger.

[0317] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value using the quantization parameter of the current block. For example, the image decoding device (2000) may clip the quantization parameter of the current block to a value between 17 and 42 and divide it into 26 parts, thereby obtaining a parameter to be applied to the difference between a first sample value and a second sample value according to the quantization parameter and a quantization parameter to be applied to a lookup table, and use them as an index of the lookup table.

[0318] In one embodiment of the present disclosure, the image decoder (2000) may determine a larger value for a parameter to be applied to the difference between a first sample value and a second sample value as the quantization parameter of the current block becomes smaller. The image decoder (2000) may determine a smaller value for a parameter to be applied to the difference between a first sample value and a second sample value as the quantization parameter of the current block becomes larger.

[0319] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the MAD information of the prediction block. Meanwhile, not limited to the disclosed examples, a parameter to be applied to the difference between a first sample value and a second sample value may be determined based on at least one of the MAD information of a restoration block corresponding to a current block including a first sample, the MAD information of a residual block corresponding to a current block, the MAD information of a restoration block corresponding to a prediction block, and the MAD information of a residual block corresponding to a prediction block.

[0320] Below, we will describe, by way of example, the operation of calculating the MAD information of the restoration block corresponding to the prediction block through mathematical formulas 9 and 10.

[0321] [Mathematical Formula 9]

[0322]

[0323] [Mathematical Formula 10]

[0324]

[0325] In one embodiment of the present disclosure, Equation 9 is an equation for calculating and using the MAD value of a restoration block corresponding to a prediction block as is, and Equation 10 is an equation for converting the MAD value of a restoration block corresponding to a prediction block into a logarithmic scale and using it. Meanwhile, not limited to the disclosed examples, the image decoding device (2000) may obtain MAD information using the size and sample value of the block to be used through Equation 9 and Equation 10.

[0326] In one embodiment of the present disclosure, as mentioned above, FIG. 23 The first function and The second function If expressed in the form of a function, the first function of FIG. 23 can be expressed by substituting c=4 and k=8, and the second function of FIG. 23 can be expressed by substituting c=4 and k=24. The image decoding device (2000) can treat k as a constant and c as a variable that changes based on various information associated with the current block.

[0327] In one embodiment of the present disclosure, an image decoding device (2000) can obtain a first adjustment function and a second adjustment function by determining a parameter (c) to be applied to the difference between a first sample value and a second sample value based on various information associated with the current block. For example, an image decoding method can obtain a first adjustment function and a second adjustment function by determining a parameter to be applied to the difference between a first sample value and a second sample value for a luma component. The first adjustment function and the second adjustment function are In the form of the function, the constant (k) is maintained, but the function may be determined according to the parameter (c) for applying to the difference between the first sample value and the second sample value. For example, the value of the parameter (c) for applying to the difference between the first sample value and the second sample value in FIG. 23, which is 4, may be maintained, or 3 or 5 may be applied instead of 4 to obtain the first adjustment function and the second adjustment function.

[0328] In one embodiment of the present disclosure, referring to FIG. 25, the graph (2500) of FIG. 25 may include a first adjustment function and a second adjustment function according to a determined value of c and a determined value of k for applying to the difference (d) between a first sample value and a second sample value. In particular, FIG. 25 may include a first adjustment function and a second adjustment function when the value of c is 3, 4, and 5. FIG. 25 may include functions for applying to a luma component. FIG. 25 may include functions for a parameter (c) for applying to the difference between a first sample value and a second sample value having a value of 4 in the function of FIG. 23, as well as functions for a parameter (c) for applying to the difference between a first sample value and a second sample value having values ​​of 3 and 5. Meanwhile, the parameter for applying the difference between the first sample value and the second sample value for the lumina component may be different from the parameter for applying the difference between the first sample value and the second sample value for the chroma component, and may be determined independently or dependently.

[0329] In one embodiment of the present disclosure, the smaller the parameter applied to the difference between the first sample value and the second sample value, the wider the range of input values ​​that obtain a variable output value without clipping. For example, referring to FIG. 25, if the parameter (c) applied to the difference between the first sample value and the second sample value is 4, the range of input values ​​that obtain a variable output value is [0, 118], and if the parameter (c) applied to the difference between the first sample value and the second sample value is 3, the range of input values ​​that obtain a variable output value may be [0, 158].

[0330] In one embodiment of the present disclosure, the larger the parameter applied to the difference between the first sample value and the second sample value, the narrower the range of input values ​​that obtain a variable output value without clipping. For example, when the parameter (c) applied to the difference between the first sample value and the second sample value is 5, the range of input values ​​that obtain a variable output value may be [0, 95].

[0331] In one embodiment of the present disclosure, the image decoder (2000) may determine an offset for bidirectional filtering using the lookup table of FIG. 24 using the first adjustment function and the second adjustment function of FIG. 25 and / or the quantization parameter of the current block. The image decoder (2000) may determine an offset for bidirectional filtering using a lookup table obtained by adjusting the quantization parameter value to a range of +1 or -1 based on information associated with the current block. For example, if the quantization parameter value for the current block is 36 or higher, the image decoder (2000) may improve the performance of filtering so that weaker filtering than before is performed by using a quantization parameter value smaller than the existing quantization parameter value.

[0332] Meanwhile, the values ​​of the parameter (c) and the predetermined constant (k) to be applied to the difference between the first sample value and the second sample value are not limited to the example disclosed in FIG. 25. An example of determining the parameter to be applied to the difference between the first sample value and the second sample value using various information associated with the current block will be examined in detail through FIG. 28.

[0333] According to one embodiment of the present disclosure, in the process of decoding and encoding an image, the compression performance of the image can be improved, the prediction performance can be improved, and the decoding quality of the image can be improved.

[0334] FIG. 26 is a graph showing a graph used to determine an offset for bidirectional filtering of chroma components according to one embodiment of the present disclosure.

[0335] In one embodiment of the present disclosure, the third and fourth functions of FIG. 23 are designed to be changeable by various parameters, thereby enabling bidirectional filtering that is more suitable for the current block.

[0336] In one embodiment of the present disclosure, of FIG. 23 The third function and The fourth function It can be expressed in the form of a function. For example, In this case, the third function is the case where c=8 and k=8, and the fourth function may be the case where c=8 and k=24.

[0337] In one embodiment of the present disclosure, the image decoding device (2000) uses a third function and a fourth function to determine an offset for bidirectional filtering. It can be redesigned as follows. Meanwhile, as in FIG. 25, c may be a parameter determined based on various information associated with the current block, and c may be a parameter used to determine an offset for bidirectional filtering, as a parameter to be applied to the difference between the first sample value and the second sample value. k may be a constant that has been determined or set in the image encoding device or image decoding device (2000).

[0338] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on information associated with the current block. The image decoding device (2000) may determine a parameter to apply to a value of d, which is the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is a peripheral sample of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block. Meanwhile, the prediction block corresponding to the current block may be a prediction block including a first sample.

[0339] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the fact that the prediction mode of the current block is one of an inter mode, an intra mode, an intra block copy mode, and a palette mode. For example, the image decoder (2000) may distinguish the prediction modes of the current block and obtain a parameter to apply to the difference between a first sample value and a second sample value according to each prediction mode and a quantization parameter to apply to a lookup table, thereby using them as an index of a lookup table.

[0340] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on at least one of the height of a prediction block and the width of a prediction block. For example, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the smaller value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the larger value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the height of a prediction block and the width of a prediction block. For example, the image decoding device (2000) can use the height and / or width of the prediction block as an index of the lookup table by applying a logarithmic function to the height and / or width of the prediction block and clipping to a value between 0 and 5 to divide the height and / or width into 6 parts each, thereby obtaining a parameter to apply to the difference between the first sample value and the second sample value according to the height and / or width of the prediction block and a quantization parameter to apply to the lookup table.

[0341] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a larger value as the size of the prediction block is smaller. The image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a smaller value as the size of the prediction block is larger.

[0342] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value using the quantization parameter of the current block. For example, the image decoding device (2000) may clip the quantization parameter of the current block to a value between 17 and 42 and divide it into 26 parts, thereby obtaining a parameter to be applied to the difference between a first sample value and a second sample value according to the quantization parameter and a quantization parameter to be applied to a lookup table, and use them as an index of the lookup table.

[0343] In one embodiment of the present disclosure, the image decoder (2000) may determine a larger value for a parameter to be applied to the difference between a first sample value and a second sample value as the quantization parameter of the current block becomes smaller. The image decoder (2000) may determine a smaller value for a parameter to be applied to the difference between a first sample value and a second sample value as the quantization parameter of the current block becomes larger.

[0344] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the MAD information of the prediction block. Meanwhile, not limited to the disclosed examples, a parameter to be applied to the difference between a first sample value and a second sample value may be determined based on at least one of the MAD information of a restoration block corresponding to a current block including a first sample, the MAD information of a residual block corresponding to a current block, the MAD information of a restoration block corresponding to a prediction block, and the MAD information of a residual block corresponding to a prediction block.

[0345] In one embodiment of the present disclosure, the image decoding device (2000) can obtain MAD information using the size and sample value of the block to be used through Equation 9 and Equation 10 in the description of FIG. 25.

[0346] In one embodiment of the present disclosure, as mentioned above, FIG. 23 The third function and The fourth function If expressed in the form of a function, the third function of FIG. 23 can be expressed by substituting c=8 and k=8, and the fourth function of FIG. 23 can be expressed by substituting c=8 and k=24. The image decoding device (2000) can treat k as a constant and c as a variable that changes based on various information associated with the current block.

[0347] In one embodiment of the present disclosure, an image decoding device (2000) can obtain a third adjustment function and a fourth adjustment function by determining a parameter (c) to be applied to the difference between a first sample value and a second sample value based on various information associated with the current block. For example, an image decoding method can obtain a third adjustment function and a fourth adjustment function by determining a parameter to be applied to the difference between a first sample value and a second sample value for a luma component. The third adjustment function and the fourth adjustment function are In the form of the function, the constant (k) is maintained, but the function may be determined according to the parameter (c) for applying to the difference between the first sample value and the second sample value. For example, the value of the parameter (c) for applying to the difference between the first sample value and the second sample value in FIG. 23, which is 8, may be maintained, or 6 or 10 may be applied instead of 8 to obtain the third adjustment function and the fourth adjustment function.

[0348] In one embodiment of the present disclosure, referring to FIG. 26, the graph (2600) of FIG. 26 may include a third adjustment function and a fourth adjustment function according to a determined value of c and a determined value of k, for applying to the difference (d) between a first sample value and a second sample value. In particular, FIG. 25 may include a first adjustment function and a second adjustment function when the value of c is 6, 8, and 10. FIG. 26 may include functions for applying to chroma components. FIG. 26 may include functions for a parameter (c) for applying to the difference between a first sample value and a second sample value having a value of 8 in the function of FIG. 23, as well as functions for a parameter (c) for applying to the difference between a first sample value and a second sample value having values ​​of 6 and 10. Meanwhile, the parameter for applying the difference between the first sample value and the second sample value for the chroma component may be different from the parameter for applying the difference between the first sample value and the second sample value for the lumina component, and may be determined independently or dependently.

[0349] In one embodiment of the present disclosure, the smaller the parameter applied to the difference between the first sample value and the second sample value, the wider the range of input values ​​that obtain a variable output value without clipping. For example, referring to FIG. 26, if the parameter (c) applied to the difference between the first sample value and the second sample value is 8, the range of input values ​​that obtain a variable output value is [0, 59], and if the parameter (c) applied to the difference between the first sample value and the second sample value is 6, the range of input values ​​that obtain a variable output value may be [0, 79].

[0350] In one embodiment of the present disclosure, the larger the parameter applied to the difference between the first sample value and the second sample value, the narrower the range of input values ​​that obtain a variable output value without clipping. For example, when the parameter (c) applied to the difference between the first sample value and the second sample value is 10, the range of input values ​​that obtain a variable output value may be [0, 48].

[0351] In one embodiment of the present disclosure, the image decoder (2000) may determine an offset for bidirectional filtering using the lookup table of FIG. 24 using the first adjustment function and the second adjustment function of FIG. 25 and / or the quantization parameter of the current block. The image decoder (2000) may determine an offset for bidirectional filtering using a lookup table obtained by adjusting the quantization parameter value to a range of +1 or -1 based on information associated with the current block. For example, if the quantization parameter value for the current block is 36 or higher, the image decoder (2000) may improve the performance of filtering so that weaker filtering than before is performed by using a quantization parameter value smaller than the existing quantization parameter value.

[0352] Meanwhile, the values ​​of the parameter (c) and the predetermined constant (k) to be applied to the difference between the first sample value and the second sample value are not limited to the example disclosed in FIG. 26. An example of determining the parameter to be applied to the difference between the first sample value and the second sample value using various information associated with the current block will be examined in detail through FIG. 28.

[0353] FIG. 27 is a drawing showing a graph used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0354] In one embodiment of the present disclosure, the original graph (2710) may be a graph of a lookup table to which parameters previously determined for the difference between the first sample value and the second sample value are applied, without performing an operation to determine parameters to be applied to the difference between the first sample value and the second sample value. Additionally, unlike the graph of a two-dimensional lookup table for a plurality of quantization parameters of FIG. 24, the original graph (2710) may include a graph representing a one-dimensional lookup table corresponding to the value of one quantization parameter for the current block.

[0355] In one embodiment of the present disclosure, the first adjustment graph (2720) may indicate that the parameter applied to the difference between the first sample value and the second sample value is determined to be a larger value than in the original graph (2710), and that the quantization parameter applied to the lookup table is adjusted to a larger value. Accordingly, compared to the original graph (2710), the first adjustment graph (2720) can be seen to have a narrower range of input values ​​and a larger maximum value for obtaining variable output values. The image decoding device (2000) can obtain a range of input values ​​for obtaining a narrower variable output value as the parameter applied to the difference between the first sample value and the second sample value increases. As the value of the quantization parameter applied to the lookup table increases, the maximum value of the offset for bidirectional filtering can increase. Meanwhile, the center in the original graph (2710) may be the same as the center in the first adjustment graph (2720), and the adjusted function may be expressed as nw.

[0356] In one embodiment of the present disclosure, the second adjustment graph (2730) may indicate that the quantization parameter applied to the lookup table has been adjusted to a larger value than in the original graph (2710). Accordingly, the second adjustment graph (2730) can be seen to have a larger maximum value of the function compared to the original graph (2710). As the value of the quantization parameter to be applied to the lookup table increases, the maximum value of the offset for bidirectional filtering may increase. Meanwhile, the center in the original graph (2710) may be the same as the center in the second adjustment graph (2730), and the adjusted function may be represented as n.

[0357] In one embodiment of the present disclosure, the third adjustment graph (2740) may indicate that the parameter applied to the difference between the first sample value and the second sample value is determined to be a smaller value than in the original graph (2710), and the quantization parameter applied to the lookup table is adjusted to a larger value. Accordingly, compared to the original graph (2710), the third adjustment graph (2740) can be seen to have a wider range of input values ​​for obtaining variable output values ​​and a larger maximum value of the function. The image decoder (2000) can obtain a wider range of input values ​​for obtaining variable output values ​​as the parameter applied to the difference between the first sample value and the second sample value becomes smaller. As the value of the quantization parameter applied to the lookup table becomes larger, the maximum value of the offset for bidirectional filtering can become larger. Meanwhile, the center in the original graph (2710) may be the same as the center in the third adjustment graph (2740), and the adjusted function may be expressed as ne.

[0358] In one embodiment of the present disclosure, the fourth adjustment graph (2750) may indicate that the parameter applied to the difference between the first sample value and the second sample value is determined to be a larger value than in the original graph (2710). Accordingly, the fourth adjustment graph (2750) can be seen to have a narrower range of input values ​​for obtaining a variable output value compared to the original graph (2710). The image decoder (2000) can obtain a range of input values ​​for obtaining a narrower variable output value as the parameter applied to the difference between the first sample value and the second sample value increases. Meanwhile, the center in the original graph (2710) may be the same as the center in the fourth adjustment graph (2750), and the adjusted function may be expressed as w.

[0359] In one embodiment of the present disclosure, the fifth adjustment graph (2760) may indicate that the parameter for applying the difference between the first sample value and the second sample value is determined to be a smaller value than in the original graph (2710). Accordingly, the fifth adjustment graph (2760) can be seen to have a wider range of input values ​​for obtaining a variable output value compared to the original graph (2710). The image decoder (2000) can obtain a wider range of input values ​​for obtaining a variable output value as the parameter for applying the difference between the first sample value and the second sample value becomes smaller. Meanwhile, the center in the original graph (2710) may be the same as the center in the fifth adjustment graph (2760), and the adjusted function may be represented as e.

[0360] In one embodiment of the present disclosure, the sixth adjustment graph (2770) may indicate that the parameter applied to the difference between the first sample value and the second sample value is determined to be a larger value than in the original graph (2710), and the quantization parameter applied to the lookup table is adjusted to a smaller value. Accordingly, compared to the original graph (2710), the sixth adjustment graph (2770) can be seen to have a narrower range of input values ​​for obtaining variable output values ​​and a smaller maximum value of the function. The image decoder (2000) can obtain a range of input values ​​for obtaining a narrower variable output value as the parameter applied to the difference between the first sample value and the second sample value increases. As the value of the quantization parameter applied to the lookup table decreases, the maximum value of the offset for bidirectional filtering can decrease. Meanwhile, in the original graph (2710), the center may be the same as the center in the sixth adjustment graph (2770), and the adjusted function may be represented as sw.

[0361] In one embodiment of the present disclosure, the seventh adjustment graph (2780) may indicate that the quantization parameter applied to the lookup table has been adjusted to a smaller value than in the original graph (2710). Thus, the seventh adjustment graph (2780) can be seen to have a smaller maximum value of the function compared to the original graph (2710). As the value of the quantization parameter to be applied to the lookup table becomes smaller, the maximum value of the offset for bidirectional filtering may become smaller. Meanwhile, the center in the original graph (2710) may be the same as the center in the seventh adjustment graph (2780), and the adjusted function may be represented as s.

[0362] In one embodiment of the present disclosure, the eighth adjustment graph (2790) may indicate that the parameter applied to the difference between the first sample value and the second sample value is determined to be a smaller value than in the original graph (2710), and that the quantization parameter applied to the lookup table is adjusted to a smaller value. Accordingly, compared to the original graph (2710), the eighth adjustment graph (2790) can be seen to have a wider range of input values ​​for obtaining variable output values ​​and a smaller maximum value of the function. The image decoder (2000) can obtain a wider range of input values ​​for obtaining variable output values ​​as the parameter applied to the difference between the first sample value and the second sample value becomes smaller. As the value of the quantization parameter applied to the lookup table becomes smaller, the maximum value of the offset for bidirectional filtering may become smaller. Meanwhile, the center in the original graph (2710) may be the same as the center in the eighth adjustment graph (2790), and the adjusted function may be expressed as se.

[0363] FIG. 28 is a diagram showing an example of determining parameters used to determine an offset for bidirectional filtering according to one embodiment of the present disclosure.

[0364] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on information associated with the current block. The image decoding device (2000) may determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block.

[0365] In one embodiment of the present disclosure, the image decoder (2000) can determine an offset for bidirectional filtering by using a value determined using a parameter to be applied to the difference between a first sample value and a second sample value as an input value to a lookup table. For example, the image decoder (2000) can determine a range of input values ​​to obtain a variable output value and a quantization parameter to be applied to a lookup table by determining a parameter (c) to be applied to the difference between a first sample value and a second sample value and a change amount (sqp) of a quantization parameter applied to a lookup table according to the example of the table in FIG. 28. Additionally, the image decoder (2000) can perform bidirectional filtering by applying the range of input values ​​to obtain a variable output value and the quantization parameter applied to the lookup table to the difference between a first sample value and a second sample value.

[0366] In one embodiment of the present disclosure, the image decoding device (2000) may obtain different parameters for applying to the difference between a first sample value and a second sample value and / or quantization parameters applied to a lookup table depending on the prediction mode of the current block. The prediction mode of the current block may be any one of an inter mode, an intra mode, an intra block copy mode, and a palette mode.

[0367] In one embodiment of the present disclosure, the image decoder (2000) may determine various parameters for applying to the difference between a first sample value and a second sample value and quantization parameters applied to a lookup table according to the quantization parameter, the size of the prediction block, and the MAD information of the prediction block, as shown in the table of FIG. 28, when the prediction mode of the current block is an inter mode. The image decoder (2000) may determine the parameters for applying to the difference between a first sample value and a second sample value as fixed values ​​when the prediction mode is a palette mode. Meanwhile, the range of input values ​​for obtaining variable output values ​​from a lookup table based on at least one of the prediction mode, quantization parameter, the size of the prediction block, and the MAD information of the prediction block, the parameters for applying to the difference between a first sample value and a second sample value, and the amount of change for quantization parameters applied to a lookup table are not limited to the examples in the table of FIG. 28.

[0368] In one embodiment of the present disclosure, the image decoding device (2000) may obtain different parameters for applying to the difference between a first sample value and a second sample value and / or quantization parameters applied to a lookup table depending on the quantization parameters of the current block.

[0369] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to a larger value as the quantization parameter of the current block becomes smaller. Since precise filtering is required as the quantization parameter becomes smaller, the image decoder (2000) may reduce distortion in bidirectional filtering by setting a narrow range of input values ​​to obtain variable output values ​​by determining a parameter to be applied to the difference between a first sample value and a second sample value to a larger value, thereby focusing on small errors between surrounding pixels and ignoring large errors.

[0370] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to a smaller value as the quantization parameter of the current block becomes larger. Since the image decoding device (2000) is more likely to experience greater distortion due to compression as the quantization parameter becomes larger, it may reduce distortion in bidirectional filtering by setting a wide range of input values ​​to obtain variable output values ​​by determining a parameter to be applied to the difference between a first sample value and a second sample value to a smaller value, thereby performing filtering even when the difference with surrounding pixels is large.

[0371] In one embodiment of the present disclosure, the image decoding device (2000) may obtain different quantization parameters for applying to the difference between a first sample value and a second sample value and / or for applying to a lookup table, depending on the size of the block associated with the current block. The size of the block associated with the current block may be the size of the current block containing the first sample or the size of the prediction block containing the first sample, but is not limited to the disclosed examples. Hereinafter, the size of the prediction block will be described as an example.

[0372] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to be a larger value as the size of the prediction block becomes smaller. Since a smaller size of the prediction block is more likely to contain objects with a relatively complex structure, if the difference between the first sample value and the second sample value is large, it is more likely that the two samples are contained in different objects, and distortion may actually increase if strong bidirectional filtering is applied. Therefore, the image decoder (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to be a larger value as the size of the prediction block becomes smaller, thereby setting a narrow range of input values ​​to obtain variable output values, so that large errors between surrounding pixels are ignored and small errors are filtered intensively.

[0373] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to a smaller value as the size of the prediction block increases. Since the larger the size of the prediction block, the higher the likelihood that it contains objects with a relatively simple structure, it may be appropriate to apply bidirectional filtering overall even if the difference between the first sample value and the second sample value is large. Accordingly, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value to a smaller value as the size of the prediction block increases, thereby setting a wide range of input values ​​to obtain variable output values, and may perform weak bidirectional filtering to reduce distortion caused by applying filtering even to areas where filtering is unnecessary.

[0374] In one embodiment of the present disclosure, the image decoding device (2000) may obtain different parameters for applying to the difference between a first sample value and a second sample value and / or quantization parameters applied to a lookup table according to the MAD information of the block associated with the current block. The MAD information of the block associated with the current block may be a reconstructed block corresponding to the current block containing the first sample, a residual block corresponding to the current block, a reconstructed block corresponding to the prediction block containing the first sample, or a residual block corresponding to the prediction block, but is not limited to the disclosed examples. Hereinafter, MAD information for a reconstructed block corresponding to a prediction block (e.g., a MAD value, or a log scale of a MAD value) will be described as an example.

[0375] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a larger value as the MAD of the restoration block corresponding to the prediction block becomes smaller. Since the smaller the MAD of the restoration block corresponding to the prediction block, the higher the probability that the error between the majority of adjacent pixels is small, if the difference between the first sample value and the second sample value is large among a few neighboring pixels, it is highly likely that the two samples are contained in different objects, and distortion may actually increase when strong bidirectional filtering is applied. Therefore, the image decoding device (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to a larger value as the MAD corresponding to the prediction block becomes smaller, thereby setting a narrow range of input values ​​to obtain variable output values, so that large errors between surrounding pixels are ignored and small errors are filtered intensively.

[0376] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to be a smaller value as the MAD of the restoration block corresponding to the prediction block becomes larger. Since the larger the MAD of the restoration block corresponding to the prediction block, the higher the likelihood that the error between the majority of adjacent pixels will be large, it may be appropriate to perform bidirectional filtering comprehensively even when conventional bidirectional filtering is not performed. Accordingly, the image decoder (2000) may determine a parameter to be applied to the difference between the first sample value and the second sample value to be a smaller value as the MAD corresponding to the prediction block becomes larger, thereby setting a wide range of input values ​​to obtain variable output values, so that bidirectional filtering can be applied more comprehensively.

[0377] In one embodiment of the present disclosure, referring to the example of the table in FIG. 28, the image decoding device (2000) can determine a parameter (c) to be applied to the difference between a first sample value and a second sample value and / or a change amount (sqp) of the quantization parameter applied to a lookup table based on the prediction mode of the current block, the quantization parameter, the size of the prediction block, and the MAD information of the recovery block corresponding to the prediction block.

[0378] In one embodiment of the present disclosure, the image decoder (2000) can determine an offset for bidirectional filtering by using the quantization parameter of the current block and the amount of change of the quantization parameter applied to the lookup table, through the quantization parameter and the lookup table based on the difference between the first sample value and the second sample value. For example, referring to the example of FIG. 28, the image decoder (2000) can determine that when the prediction mode of the current block is intra mode, the quantization parameter value is 38, the size of the prediction block is 32x32, and the MAD value of the recovery block corresponding to the prediction block is 256, the parameter (c) to be applied to the difference between the first sample value and the second sample value is determined to be 3, and the amount of change of the quantization parameter (sqp) applied to the lookup table can be determined to be -1. Accordingly, the image decoding device (2000) can determine the offset of bidirectional filtering by setting the value of the quantization parameter applied to the lookup table according to the difference between the quantization parameter and the first sample value and the second sample value to 37.

[0379] Meanwhile, the table in FIG. 28 is an exemplary simplified representation of the range of input values ​​and the trend of filtering strength to obtain variable output values ​​according to information associated with the current block, and is not limited to the disclosed examples.

[0380] FIG. 29 is a flowchart of an image decoding method according to one embodiment.

[0381] In step S2910, the image decoder (2000) may decide to perform bidirectional filtering on the current block based on information regarding whether to perform bidirectional filtering within in-loop filtering obtained from the bitstream.

[0382] In one embodiment of the present disclosure, the image decoding device (2000) may obtain information from the bitstream regarding whether to perform in-loop filtering. The image decoding device (2000) may obtain information from the bitstream regarding whether to perform bidirectional filtering within the in-loop filtering. For example, the image decoding device (2000) may obtain information from the bitstream regarding whether to perform bidirectional filtering within the in-loop filtering as a flag or an index. The image decoding device (2000) may determine to perform bidirectional filtering for the current block based on the flag or index indicating that bidirectional filtering within the in-loop filtering is performed obtained from the bitstream.

[0383] Meanwhile, not limited to the disclosed examples, whether to perform bidirectional filtering may be implied by information associated with bidirectional filtering within in-loop filtering.

[0384] In step S2920, the image decoder (2000) can determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block.

[0385] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on information associated with the current block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is a peripheral sample of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block.

[0386] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the fact that the prediction mode of the current block is one of an inter mode, an intra mode, an intra block copy mode, and a palette mode. For example, the image decoder (2000) may distinguish the prediction modes of the current block and obtain a parameter to apply to the difference between a first sample value and a second sample value according to each prediction mode and a quantization parameter to apply to a lookup table, thereby using them as an index of a lookup table.

[0387] In one embodiment of the present disclosure, the image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on at least one of the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the smaller value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the larger value between the height of a prediction block and the width of a prediction block. The image decoder (2000) may determine a parameter to apply to the difference between a first sample value and a second sample value based on the height of a prediction block and the width of a prediction block. For example, the image decoding device (2000) can use the height and / or width of the prediction block as an index of the lookup table by applying a logarithmic function to the height and / or width of the prediction block and clipping to a value between 0 and 5 to divide the height and / or width into 6 parts each, thereby obtaining a parameter to apply to the difference between the first sample value and the second sample value according to the height and / or width of the prediction block and a quantization parameter to apply to the lookup table.

[0388] In one embodiment of the present disclosure, the smaller the size of the prediction block, the larger the parameter to be applied to the difference between the first sample value and the second sample value may be. The larger the size of the prediction block, the smaller the parameter to be applied to the difference between the first sample value and the second sample value may be.

[0389] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value using the quantization parameter of the current block. For example, the image decoding device (2000) may clip the quantization parameter of the current block to a value between 17 and 42 and divide it into 26 parts, thereby obtaining a parameter to be applied to the difference between a first sample value and a second sample value according to the quantization parameter and a quantization parameter to be applied to a lookup table, and use them as an index of the lookup table.

[0390] In one embodiment of the present disclosure, as the quantization parameter of the current block becomes smaller, the parameter for applying to the difference between the first sample value and the second sample value may become larger. As the quantization parameter of the current block becomes larger, the parameter for applying to the difference between the first sample value and the second sample value may become smaller.

[0391] In one embodiment of the present disclosure, the image decoding device (2000) may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the MAD information of the prediction block. The MAD information of the prediction block may include the MAD value of the restoration block corresponding to the prediction block, the MAD value of the residual block corresponding to the prediction block, or the log scale value thereof. Meanwhile, not limited to the disclosed examples, the MAD information may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the MAD value of the restoration block corresponding to the current block containing the first sample included in the prediction block, the MAD value of the residual block corresponding to the current block, or the log scale thereof.

[0392] In one embodiment of the present disclosure, the smaller the MAD value of the restoration block corresponding to the prediction block, the larger the parameter to be applied to the difference between the first sample value and the second sample value. The larger the MAD value of the restoration block corresponding to the prediction block, the smaller the parameter to be applied to the difference between the first sample value and the second sample value.

[0393] In one embodiment of the present disclosure, parameters for applying to the difference between a first sample value and a second sample value may be determined for a luminance component and a chroma component, respectively. For example, an image decoder (2000) may determine parameters for applying to the difference between a first sample value and a second sample value for a luminance component. An image decoder (2000) may determine parameters for applying to the difference between a first sample value and a second sample value for a chroma component. An image decoder (2000) may determine parameters for a chroma component based on parameters for a luminance component, or may determine them independently of each.

[0394] Hereinafter, step S2920 has been specifically explained in FIGS. 20 to 28, so the same content is omitted.

[0395] In step S2930, the image decoder (2000) can determine an offset for bidirectional filtering by applying the parameter to the difference between the first sample value and the second sample value.

[0396] In one embodiment of the present disclosure, the image decoding device (2000) may apply a parameter to the difference between the first sample value and the second sample value. For example, the image decoding device (2000) may obtain an offset for bidirectional filtering by using a parameter to apply to the difference between the first sample value and the second sample value and a quantization parameter to apply to the lookup table as an index of the lookup table. Additionally, the image decoding device (2000) may obtain a scale factor for determining the filtering strength by using the size of the prediction block and the MAD information of the prediction block. The image decoding device (2000) may determine an offset for bidirectional filtering by using the value obtained from the lookup table using the parameter to apply to the difference between the first sample value and the second sample value and the quantization parameter to apply to the lookup table, and the scale factor for determining the filtering strength.

[0397] Hereinafter, step S2930 has been specifically explained in FIGS. 20 to 28, so the same content is omitted.

[0398] In step S2940, the image decoder (2000) can obtain a bidirectionally filtered block by applying an offset for bidirectional filtering to the current block.

[0399] In one embodiment of the present disclosure, the image decoding device (2000) may obtain a bidirectionally filtered block by summing an offset for bidirectional filtering obtained for the current block and / or an offset for sample adaptive offset filtering for the current block. Meanwhile, depending on whether individual filtering is performed within the in-loop filtering, the bidirectionally filtered block may be a block obtained during the process of performing the in-loop filtering, or it may be the output of the in-loop filtering.

[0400] In one embodiment of the present disclosure, the offset for bidirectional filtering obtained for the current block may represent the offset for bidirectional filtering obtained for all samples included in the current block.

[0401] Hereinafter, step S2940 has been specifically explained in FIGS. 20 to 21, so the same content is omitted.

[0402] FIG. 30 is a block diagram illustrating the configuration of an image encoding device according to one embodiment.

[0403] In one embodiment of the present disclosure, the memory (3010) and the processor (3030) may be implemented as at least one memory and at least one processor. In one embodiment of the present disclosure, when instructions are stored in the memory (3010), the operation of the prediction encoder (1915) and the entropy encoder (1925) illustrated in FIG. 19 may be implemented according to instructions called by at least one process.

[0404] In one embodiment of the present disclosure, the image encoding device (3000) may include a storage medium that stores at least one of the following input / output data: a prediction encoding unit (1915), a conversion and quantization unit (1920), an entropy encoding unit (1925), an inverse quantization and inverse conversion unit (1930), and an in-loop filtering unit (1940) as shown in FIG. 19. The storage medium may be included in a memory (3010) or may be a different storage medium separate from the memory (3010).

[0405] Additionally, the video encoding device (3000) may include a storage medium control unit that controls the data input and output of the storage medium. The storage medium control unit may be included in the processor (3030), or it may be a control unit different from the processor (3030).

[0406] In one embodiment of the present disclosure, the image encoding device (3000) can determine the prediction mode of the current block in the current image. As the prediction mode of the current block, a prediction mode such as an intra mode, an inter mode, an intra block copy mode, and / or a palette mode may be used.

[0407] In one embodiment of the present disclosure, the image encoding device (3000) can generate information about the prediction mode of the current block using a determined prediction mode of the current block, and can generate a bitstream containing information about the prediction mode of the current block. For example, the image encoding device (3000) can generate an index representing the prediction mode of the current block, and can generate a bitstream containing the index representing the prediction mode of the current block.

[0408] In one embodiment of the present disclosure, the prediction mode of the current block may be determined as an inter mode. An image encoding device (3000) may perform a prediction on the current block according to the prediction mode of the current block and may encode the current block using the prediction block generated as a result of the prediction. The bitstream may include information regarding the prediction mode of the current block. The information regarding the prediction mode of the current block may be included in the sequence parameter set, picture parameter set, slice header, or slice data of the bitstream.

[0409] In one embodiment of the present disclosure, encoding of the current block may mean a process of generating information that enables an image decoding device (2000) to restore the current block. The information generated through encoding may be included in a bitstream after undergoing additional processing.

[0410] In one embodiment of the present disclosure, when a prediction block is generated through a prediction for the current block, the image encoding device (3000) can encode the current block using the prediction block.

[0411] In one embodiment of the present disclosure, the image encoding device (3000) may generate residual data corresponding to the difference between the prediction block and the current block. If the prediction block is determined to be the current block, residual data may not be generated.

[0412] In one embodiment of the present disclosure, the image encoding device (3000) may generate a bitstream including information generated according to the encoding of an image. The bitstream may include data generated as a result of encoding for the current block. The bitstream may include prediction information for the current block.

[0413] In one embodiment of the present disclosure, the bitstream may include information regarding quantization parameters of a current block within the current image. The information regarding quantization parameters may include information for determining quantization parameters for a luminance component and / or quantization parameters for a chroma component. Quantization parameters may be determined per slice or maximum encoding block (or unit).

[0414] In one embodiment of the present disclosure, the image encoding device (3000) may perform in-loop filtering through an in-loop filtering unit (1940). The in-loop filtering may be a filtering operation that performs at least one of deblocking filtering using a deblocking filter, SAO filtering using a Sample Adaptive Offset (SAO) filter, bilateral filtering using a bilateral filter, and ALF filtering using an Adaptive Loop Filter (ALF) on a restored block in the current image.

[0415] In one embodiment of the present disclosure, the image encoding device (3000) may perform deblocking filtering. Deblocking filtering may be an operation that improves image quality by smoothing the boundaries between blocks. The image encoding device (3000) may perform filtering on samples of the current block where deblocking filtering has been performed using a Sample Adaptive Offset (SAO) filter and / or a Bilateral Filter (BIF). The SAO filter and BIF can improve image quality by reducing the error between the reconstructed image and the original image. The SAO filter and BIF may perform filtering on a sample basis. The image encoding device (3000) may perform filtering using an Adaptive Loop Filter (ALF). The ALF can improve image quality by reducing the error between the reconstructed image and the original image. The ALF may perform filtering on a block basis. Meanwhile, the filtering operation through the deblocking filter, SAO filter, BIF, and / or adaptive loop filter in the video encoding device (3000) may be an operation performed in the in-loop filtering unit (1970).

[0416] In one embodiment of the present disclosure, the image encoding device (3000) may determine whether to perform deblocking filtering within in-loop filtering, sample adaptive offset filtering, bidirectional filtering, and / or adaptive loop filtering, respectively. Based on the determination of whether to perform deblocking filtering within in-loop filtering, sample adaptive offset filtering, bidirectional filtering, and / or adaptive loop filtering, the image encoding device (3000) may generate information for each filtering within in-loop filtering. For example, the image encoding device (3000) may determine whether to perform bidirectional filtering within in-loop filtering. The image encoding device (3000) may generate an index or flag indicating whether to perform bidirectional filtering within in-loop filtering, and may generate a bitstream including an index or flag indicating whether to perform bidirectional filtering.

[0417] In one embodiment of the present disclosure, the image encoding device (3000) may perform in-loop filtering through an in-loop filtering unit (1940) to determine whether to perform a predetermined filtering within the in-loop filtering at the slice and / or maximum encoding unit level. The image encoding device (3000) may determine to perform the predetermined filtering only when the rate distortion optimization cost (RDO cost) for the predetermined filtering is less than or equal to a preset value by calculating the rate distortion optimization cost (RDO cost) for the predetermined filtering. For example, the image encoding device (3000) may determine whether to perform bidirectional filtering on the current slice by considering the rate distortion cost calculated by performing bidirectional filtering on the current slice.

[0418] In one embodiment of the present disclosure, the image encoding device (3000) may decide to perform bidirectional filtering on the current slice by considering the rate distortion cost calculated by performing bidirectional filtering on the current slice. When the image encoding device (3000) decides to perform bidirectional filtering on the current slice, it may decide whether to perform bidirectional filtering on a plurality of maximum encoding units included in the current slice.

[0419] In one embodiment of the present disclosure, the image encoding device (3000) may generate information regarding whether to perform bidirectional filtering on a current slice and information regarding whether to perform bidirectional filtering on a plurality of maximum encoding units within the current slice. The image encoding device (3000) may generate a bitstream including information regarding whether to perform bidirectional filtering on a current slice and information regarding whether to perform bidirectional filtering on a plurality of maximum encoding units within the current slice.

[0420] In one embodiment of the present disclosure, the image encoding device (3000) can further improve the quality of the image by performing bidirectional filtering using various parameters.

[0421] In one embodiment of the present disclosure, the image encoding device (3000) can transmit the bitstream to the image decoding device (2000) through a network.

[0422] In one embodiment of the present disclosure, the image encoding device (3000) can store a bitstream in a data storage medium including a magnetic medium such as a hard disk, a floppy disk and a magnetic tape, an optical recording medium such as a CD-ROM and a DVD, a magneto-optical medium such as a floptical disk, etc.

[0423] In one embodiment of the present disclosure, the image encoding device (3000) may generate a bitstream including syntax elements generated through the encoding of an image. Values ​​corresponding to the syntax elements may be included in the bitstream according to the hierarchical structure of the image.

[0424] In one embodiment of the present disclosure, an image encoding device (3000) may encode bins of syntax elements and include them in a bitstream. The encoding operation may include at least one of a binarization and an entropy encoding operation.

[0425] In one embodiment of the present disclosure, the operation of the image encoding device (3000) may be the same as the operation of the image decoding device (2000), so the same content is omitted.

[0426] FIG. 31 is a flowchart of an image encoding method according to one embodiment.

[0427] In step S3110, the image encoding device (3000) can determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample, which is one of the surrounding samples of the first sample value, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block.

[0428] In one embodiment of the present disclosure, the image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on information associated with the current block. The image encoding device may determine a parameter to be applied to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is a peripheral sample of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block.

[0429] In one embodiment of the present disclosure, the image encoding device may determine a parameter to apply to the difference between a first sample value and a second sample value based on the fact that the prediction mode of the current block is one of an inter mode, an intra mode, an intra block copy mode, and a palette mode. For example, the image encoding device may distinguish the prediction modes of the current block and obtain a parameter to apply to the difference between a first sample value and a second sample value according to each prediction mode and a quantization parameter to apply to a lookup table, thereby using them as an index of a lookup table.

[0430] In one embodiment of the present disclosure, the image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on at least one of the height of a prediction block and the width of a prediction block. The image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the smaller value between the height of a prediction block and the width of a prediction block. The image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the larger value between the height of a prediction block and the width of a prediction block. The image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the height of a prediction block and the width of a prediction block. For example, a video encoding device can apply a logarithmic function to the height and / or width of a prediction block and clip it to a value between 0 and 5 to divide the height and / or width into 6 parts each, thereby obtaining a parameter to apply to the difference between a first sample value and a second sample value according to the height and / or width of the prediction block and a quantization parameter to apply to a lookup table, which can then be used as an index of a lookup table.

[0431] In one embodiment of the present disclosure, the smaller the size of the prediction block, the larger the parameter to be applied to the difference between the first sample value and the second sample value may be. The larger the size of the prediction block, the smaller the parameter to be applied to the difference between the first sample value and the second sample value may be.

[0432] In one embodiment of the present disclosure, the image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value using the quantization parameter of the current block. For example, the image encoding device may clip the quantization parameter of the current block to a value between 17 and 42 and divide it into 26 parts, and obtain a parameter to be applied to the difference between a first sample value and a second sample value according to the quantization parameter and a quantization parameter to be applied to a lookup table, thereby using them as an index of the lookup table.

[0433] In one embodiment of the present disclosure, as the quantization parameter of the current block becomes smaller, the parameter for applying to the difference between the first sample value and the second sample value may become larger. As the quantization parameter of the current block becomes larger, the parameter for applying to the difference between the first sample value and the second sample value may become smaller.

[0434] In one embodiment of the present disclosure, the image encoding device may determine a parameter to be applied to the difference between a first sample value and a second sample value based on MAD information of a prediction block. The MAD information of the prediction block may include the MAD value of a restoration block corresponding to the prediction block, the MAD value of a residual block corresponding to the prediction block, or a log scale value thereof. Meanwhile, not limited to the disclosed examples, the MAD information may determine a parameter to be applied to the difference between a first sample value and a second sample value based on the MAD value of a restoration block corresponding to a current block containing a first sample included in the prediction block, the MAD value of a residual block corresponding to the current block, or a log scale thereof.

[0435] In one embodiment of the present disclosure, the smaller the MAD value of the restoration block corresponding to the prediction block, the larger the parameter to be applied to the difference between the first sample value and the second sample value. The larger the MAD value of the restoration block corresponding to the prediction block, the smaller the parameter to be applied to the difference between the first sample value and the second sample value.

[0436] In one embodiment of the present disclosure, parameters for applying to the difference between a first sample value and a second sample value may be determined for a luminance component and a chroma component, respectively. For example, an image encoding device may determine parameters for applying to the difference between a first sample value and a second sample value for a luminance component. An image encoding device may determine parameters for applying to the difference between a first sample value and a second sample value for a chroma component. An image encoding device may determine parameters for a chroma component based on parameters for a luminance component, or may determine them independently of each.

[0437] Meanwhile, the lookup tables used by the video encoding device may be lookup tables shared by the video decoding device (2000) and the video encoding device with the same content, and may be data already stored or set in the video decoding device (2000) and the video encoding device.

[0438] Hereinafter, step S3110 has been specifically described in FIGS. 21 to 28 and FIG. 30, so the same content is omitted.

[0439] In step S3120, the image encoding device (2000) can determine an offset for bidirectional filtering within in-loop filtering by applying a parameter to the difference between the first sample value and the second sample value.

[0440] In one embodiment of the present disclosure, the image encoding device may apply a parameter to the difference between a first sample value and a second sample value. For example, the image encoding device may obtain an offset for bidirectional filtering by using a parameter to apply to the difference between a first sample value and a second sample value and a quantization parameter to apply to a lookup table as an index of the lookup table. Additionally, the image encoding device may obtain a scale factor for determining the filtering strength by using the size of the prediction block and the MAD information of the prediction block. The image encoding device may determine an offset for bidirectional filtering by using the value obtained from the lookup table using the parameter to apply to the difference between a first sample value and a second sample value and the quantization parameter to apply to the lookup table, and the scale factor for determining the filtering strength.

[0441] Hereinafter, step S3120 has been specifically described in FIGS. 21 to 28 and FIG. 30, so the same content is omitted.

[0442] In step S3130, the image encoding device (2000) can determine whether to perform bidirectional filtering by applying an offset to the current block.

[0443] In one embodiment of the present disclosure, the image encoding device may obtain a bidirectionally filtered block by applying an offset for bidirectional filtering to the current block. The image encoding device may determine whether to perform bidirectional filtering based on the bidirectionally filtered block and / or the in-loop filtered block.

[0444] In one embodiment of the present disclosure, the image encoding device may obtain a bidirectionally filtered block by summing an offset for bidirectional filtering obtained for the current block and / or an offset for sample adaptive offset filtering for the current block. Meanwhile, depending on whether individual filtering is performed within the in-loop filtering, the bidirectionally filtered block may be a block obtained during the process of performing the in-loop filtering, or it may be the output of the in-loop filtering.

[0445] In one embodiment of the present disclosure, the offset for bidirectional filtering obtained for the current block may represent the offset for bidirectional filtering obtained for all samples included in the current block.

[0446] In one embodiment of the present disclosure, the image encoding device may calculate the Rate Distortion Optimization cost (RDO cost) for bidirectional filtering and decide to perform bidirectional filtering only when the RDO cost is less than or equal to a preset value. For example, the image encoding device may decide whether to perform bidirectional filtering on the current slice by considering the Rate Distortion Optimization cost calculated by performing bidirectional filtering on the current slice.

[0447] In one embodiment of the present disclosure, the image encoding device may decide to perform bidirectional filtering on the current slice by considering the rate distortion cost calculated by performing bidirectional filtering on the current slice. When the image encoding device decides to perform bidirectional filtering on the current slice, it may decide whether to perform bidirectional filtering on a plurality of maximum encoding units included in the current slice.

[0448] Hereinafter, step S3130 has been specifically described in FIGS. 21 to 28 and FIG. 30, so the same content is omitted.

[0449] In step S3140, the video encoding device (2000) can generate a bitstream containing information on whether to perform bidirectional filtering.

[0450] In one embodiment of the present disclosure, the image encoding device may generate information regarding whether to perform bidirectional filtering on a current slice and information regarding whether to perform bidirectional filtering on a plurality of maximum encoding units within the current slice as an index or a flag. Meanwhile, in the present disclosure, since the current block may be included in a maximum encoding unit, the information regarding whether to perform bidirectional filtering on the current block may represent information regarding whether to perform bidirectional filtering on a maximum encoding unit including the current block.

[0451] In one embodiment of the present disclosure, the image encoding device may generate a bitstream including information on whether to perform bidirectional filtering on a current slice and information on whether to perform bidirectional filtering on a plurality of maximum encoding units within the current slice.

[0452] Hereinafter, step S3140 has been specifically described in FIGS. 21 to 28 and FIG. 30, so the same content is omitted.

[0453] In one embodiment of the present disclosure, an image decoding method may be provided. The image decoding method may include a step (S2910) of determining to perform bilateral filtering on the current block based on information regarding whether to perform bilateral filtering within in-loop filtering obtained from a bitstream. The image decoding method may include a step (S2920) of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the Mean Absolute Difference (MAD) information of the prediction block. The image decoding method may include a step (S2930) of determining an offset for bilateral filtering by applying the parameter to the difference between the first sample value and the second sample value. The image decoding method may include the step (S2940) of obtaining a bidirectionally filtered block by applying an offset to the current block.

[0454] In one embodiment of the present disclosure, the image decoding method may include the step of determining a parameter to apply to the difference between a first sample value and a second sample value based on the fact that the prediction mode of the current block is any one of an inter mode, an intra mode, an intra block copy mode, and a palette mode.

[0455] In one embodiment of the present disclosure, the image decoding method may include the step of determining a parameter to apply to the difference between a first sample value and a second sample value based on at least one of the height of a prediction block and the width of a prediction block.

[0456] In one embodiment of the present disclosure, the image decoding method may include the step of determining a parameter to be applied to the difference between a first sample value and a second sample value using a quantization parameter of the current block.

[0457] In one embodiment of the present disclosure, the image decoding method may include the step of determining a parameter to apply to the difference between a first sample value and a second sample value based on the MAD information of the prediction block.

[0458] In one embodiment of the present disclosure, a parameter for applying to the difference between a first sample value and a second sample value may be characterized as increasing as the quantization parameter of the current block becomes smaller, and decreasing as the quantization parameter of the current block becomes larger.

[0459] In one embodiment of the present disclosure, a parameter for applying to the difference between a first sample value and a second sample value may be characterized as increasing as the size of the prediction block decreases and decreasing as the size of the prediction block increases.

[0460] In one embodiment of the present disclosure, a parameter for applying to the difference between a first sample value and a second sample value may be characterized in that it increases as the MAD value of the restoration block corresponding to the prediction block decreases, and decreases as the MAD value of the restoration block corresponding to the prediction block increases.

[0461] In one embodiment of the present disclosure, the parameter for applying to the difference between the first sample value and the second sample value may be characterized by being determined for the lumina component and the chroma component, respectively.

[0462] In one embodiment of the present disclosure, the image decoding method may include the step of determining a parameter to apply to the difference between a first sample value and a second sample value based on the larger value between the height of a prediction block and the width of a prediction block or the smaller value between the height of a prediction block and the width of a prediction block.

[0463] In one embodiment of the present disclosure, the image decoding method may include the step of determining an offset for bidirectional filtering using a scale factor that determines the filtering strength, which is obtained using the size of a prediction block and MAD information of a prediction block.

[0464] In one embodiment of the present disclosure, the image decoding device (2000) may include at least one memory (2010) for storing at least one instruction; and at least one processor (2030) for operating according to at least one instruction.

[0465] In one embodiment of the present disclosure, at least one processor (2030) may determine to perform bidirectional filtering on the current block based on information regarding whether to perform bidirectional filtering within in-loop filtering obtained from the bitstream. At least one processor (2030) may determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block. At least one processor (2030) may determine an offset for bidirectional filtering based on the parameter to apply to the difference between the first sample value and the second sample value. At least one processor (2030) may obtain a bidirectionally filtered block by applying the offset to the current block.

[0466] In one embodiment of the present disclosure, an image encoding method may be provided. The image encoding method may include a step (S3110) of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of the prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block. The image encoding method may include a step (S3120) of determining an offset for bidirectional filtering within in-loop filtering by applying the parameter to the difference between the first sample value and the second sample value. The image encoding method may include a step (S3130) of determining whether to perform bidirectional filtering by applying the offset to the current block. The image encoding method may include a step (S3140) of generating a bitstream containing information regarding whether to perform bidirectional filtering.

[0467] In one embodiment of the present disclosure, the image encoding device (3000) may include at least one memory (3010) for storing at least one instruction; and at least one processor (3030) that operates according to at least one instruction. The at least one processor (3030) may determine a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block. The at least one processor (3030) may determine an offset for bidirectional filtering within in-loop filtering by applying the parameter to the difference between the first sample value and the second sample value. The at least one processor (3030) may determine whether to perform bidirectional filtering by applying the offset to the current block. At least one processor (3030) can generate a bitstream containing information on whether to perform bidirectional filtering.

[0468] In one embodiment of the present disclosure, a computer-readable recording medium may be provided for storing a bitstream generated by an image encoding method. The bitstream may include information regarding whether to perform bidirectional filtering within in-loop filtering. The information regarding whether to perform bidirectional filtering may be determined by obtaining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of a prediction mode of the current block, a size of the prediction block corresponding to the current block, a quantization parameter of the current block, and MAD information of the prediction block, and by using an offset for said bidirectional filtering determined by applying the parameter to the difference between the first sample value and the second sample value.

[0469] A device-readable storage medium may be provided in the form of a non-transitory storage medium. Here, 'non-transitory storage medium' simply means that it is a tangible device and does not contain a signal (e.g., electromagnetic waves), and the term does not distinguish between cases where data is stored semi-permanently and cases where it is stored temporarily. For example, a 'non-transitory storage medium' may include a buffer in which data is stored temporarily.

[0470] According to one embodiment, the method according to the various embodiments disclosed herein may be provided by being included in a computer program product. The computer program product may be traded between a seller and a buyer as a product. The computer program product may be distributed in the form of a device-readable storage medium (e.g., compact disc read-only memory (CD-ROM)), or distributed online (e.g., download or upload) through an application store or directly between two user devices (e.g., smartphones). In the case of online distribution, at least a portion of the computer program product (e.g., downloadable app) may be temporarily stored or temporarily created on a device-readable storage medium, such as the memory of a manufacturer's server, an application store's server, or a relay server.

Claims

In a video decoding method, A step (S2910) of deciding to perform bilateral filtering on the current block based on information regarding whether to perform bilateral filtering within in-loop filtering obtained from the bitstream; A step (S2920) of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample, which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the Mean Absolute Difference (MAD) information of the prediction block; A step (S2930) of determining an offset for bidirectional filtering by applying the parameter to the difference between the first sample value and the second sample value; and A method comprising the step (S2940) of obtaining a bidirectionally filtered block by applying the offset to the current block. In paragraph 1, The step (S2920) of determining a parameter to apply to the difference between the first sample value and the second sample value is, A method comprising the step of determining a parameter to apply to the difference between the first sample value and the second sample value based on the prediction mode of the current block being any one of an inter mode, an intra mode, an intra block copy mode, and a palette mode. In paragraph 1, The step (S2920) of determining a parameter to apply to the difference between the first sample value and the second sample value is, A method comprising the step of determining a parameter to apply to the difference between the first sample value and the second sample value based on at least one of the height of the prediction block and the width of the prediction block. In paragraph 1, The step (S2920) of determining a parameter to apply to the difference between the first sample value and the second sample value is, A method comprising the step of determining a parameter to be applied to the difference between the first sample value and the second sample value using the quantization parameter of the current block. In paragraph 1, The step (S2920) of determining a parameter to apply to the difference between the first sample value and the second sample value is, A method comprising the step of determining a parameter to apply to the difference between the first sample value and the second sample value based on the MAD information of the prediction block. In paragraph 1, The parameter for applying to the difference between the first sample value and the second sample value is, A method characterized by becoming larger as the quantization parameter of the current block becomes smaller, and becoming smaller as the quantization parameter of the current block becomes larger. In paragraph 1, The parameter for applying to the difference between the first sample value and the second sample value is, A method characterized by becoming larger as the size of the prediction block decreases, and becoming smaller as the size of the prediction block increases. In paragraph 1, The parameter for applying to the difference between the first sample value and the second sample value is, A method characterized by increasing as the MAD value of the restoration block corresponding to the prediction block becomes smaller, and decreasing as the MAD value of the restoration block corresponding to the prediction block becomes larger. In paragraph 1, The parameter for applying to the difference between the first sample value and the second sample value is, A method characterized by determining the lumina component and the chroma component, respectively. In paragraph 3, The step of determining a parameter to apply to the difference between the first sample value and the second sample value based on at least one of the height of the prediction block and the width of the prediction block is A method comprising the step of determining a parameter to apply to the difference between the first sample value and the second sample value based on the larger value between the height of the prediction block and the width of the prediction block or the smaller value between the height of the prediction block and the width of the prediction block. In paragraph 1, The step of determining the offset for the above bidirectional filtering is, A method comprising the step of determining an offset for bidirectional filtering using a scale factor that determines the filtering strength, obtained using the size of the prediction block and the MAD information of the prediction block. In a video encoding method, A step (S3110) of determining a parameter to apply to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample, based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block; A step (S3120) of determining an offset for bidirectional filtering within in-loop filtering by applying the parameter to the difference between the first sample value and the second sample value; A step (S3130) of determining whether to perform bidirectional filtering by applying the offset to the current block; A video encoding method comprising the step (S3140) of generating a bitstream containing information on whether to perform the above bidirectional filtering. In a computer-readable recording medium that stores a bitstream generated by a video encoding method, The above bitstream is, Includes information on whether to perform bidirectional filtering within in-loop filtering, and Information regarding whether to perform the above bidirectional filtering is, Based on at least one of the prediction mode of the current block, the size of the prediction block corresponding to the current block, the quantization parameter of the current block, and the MAD information of the prediction block, a parameter for applying to the difference between a first sample value corresponding to a first sample included in the current block and a second sample value corresponding to a second sample which is one of the surrounding samples of the first sample is obtained. A recording medium determined by using an offset for bidirectional filtering determined by applying the parameter to the difference between the first sample value and the second sample value.