Method and apparatus for encoding and decoding video based on video size
By comparing the sizes of the current block and the reference block and selecting the appropriate filter coefficient set and interval relationship, the problem of low image reconstruction quality in the prior art is solved, and a higher quality image reconstruction is achieved.
Patent Information
- Application Number
- CN202411273494.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2019-07-05
- Filing Date
- 2020-05-13
- Publication Date
- 2025-07-18
AI Technical Summary
The existing image encoding and decoding techniques are not of high enough when considering image size.
By comparing the image size of the current block with the size of the reference image, selecting an appropriate set of filter coefficients to generate predicted values, reconstructing the current block, including selecting a reference sample corresponding to the current block in the reference image, and considering the interval relationship when the size is different.
The quality of image reconstruction is improved, and more precise prediction and reconstruction is performed by taking into account the differences in image sizes.
Smart Images

Figure CN120343236A_ABST
Abstract
Description
[0001] This application is a divisional application of a patent application with an international filing date of May 13, 2020, a Chinese application number of 202080050277.9, and an invention title of "Method and Device for Encoding Video Based on Video Size, and Method and Device for Decoding Video Based on Video Size". Technical Field
[0002] The present disclosure relates to the field of image encoding and decoding. More specifically, the present disclosure relates to an image encoding method and apparatus and an image decoding method and apparatus based on an image size. Background Art
[0003] In image encoding and decoding, an image is split into blocks, and each block is prediction-encoded and prediction-decoded by interprediction or intra prediction.
[0004] Interprediction refers to a method of compressing an image by removing temporal redundancy between images, and a representative example thereof is motion estimation coding and decoding. Motion estimation coding and decoding predicts a block of a current image by using at least one reference image. By using a specific evaluation function, a reference block most similar to the current block is searched within a preset search range. The current block is predicted based on the reference block, and a predicted block generated as a result of the prediction is subtracted from the current block to generate a residual block. Then, the residual block is encoded. In this case, in order to perform prediction more accurately, interpolation may be performed on the reference image to generate pixels in sub-pixel units smaller than integer pixel units, and interprediction may be performed based on the pixels in the sub-pixel units.
[0005] In codecs such as H.264 Advanced Video Coding (AVC) and High-Efficiency Video Coding (HEVC), in order to predict a motion vector of a current block, a motion vector of a previously encoded block adjacent to the current block or a block included in a previously encoded image is used as a predicted motion vector of the current block. A differential motion vector, which is a difference between the motion vector of the current block and the predicted motion vector, is signaled to the decoder side by a specific method. Summary of the Invention
[0006] Technical Problem
[0007] The technical objective of an image encoding method and apparatus and an image decoding method and apparatus according to an embodiment is to improve the quality of a reconstructed image by encoding and decoding an image in consideration of the size of the image.
[0008] Technical solution for solving the problem
[0009] An image decoding method for decoding a video signal according to an embodiment includes: obtaining a value of a current block based on the size of a current picture and the size of a reference picture of the current block; determining a motion vector of the current block; determining a plurality of pixel positions in the reference picture by using the motion vector and the position of the upper-left pixel in the current block; selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, where the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions in the reference picture; and reconstructing the current block by using the prediction value.
[0010] An image decoding apparatus for decoding a video signal according to an embodiment includes: a prediction decoder configured to: obtain a value of a current block based on the size of a current picture and the size of a reference picture of the current block; determine a motion vector of the current block; determine a plurality of pixel positions in the reference picture by using the motion vector and the position of the upper-left pixel in the current block; select a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, where the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; generate a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions in the reference picture; and reconstruct the current block by using the prediction value.
[0011] An image encoding method for encoding a video signal according to an embodiment includes: obtaining a value of a current block based on the size of a current picture and the size of a reference picture of the current block; determining a motion vector of the current block; determining a plurality of pixel positions in the reference picture by using the motion vector and the position of the upper-left pixel in the current block; selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, where the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions in the reference picture; and encoding the current block by using the prediction value.
[0012] A non-transitory computer-readable storage medium according to an embodiment stores a bitstream, the bitstream being encoded by an encoding method, the encoding method including: obtaining a value of a current block based on a size of a current picture and a size of a reference picture of the current block; determining a motion vector of the current block; determining a plurality of pixel positions in the reference picture by using the motion vector and a position of an upper-left pixel in the current block; selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, wherein the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions in the reference picture; and encoding the current block by using the prediction value.
[0013] An image decoding method according to an embodiment includes: comparing a size of a current image including a current block with a size of a reference image; selecting, in the reference image, a reference sample corresponding to a current sample in the current block according to a motion vector of the current block; and reconstructing the current block based on the reference sample, wherein when the size of the reference image is greater than the size of the current image, the reference samples are spaced apart from each other by an interval corresponding to a result of the size comparison in the reference image.
[0014] Advantageous Effects
[0015] An image encoding method and apparatus according to an embodiment and an image decoding method and apparatus can encode and decode an image by considering the size of the image, thereby improving the quality of the reconstructed image.
[0016] It should be noted that the effects that can be achieved by an image encoding method and apparatus according to an embodiment and an image decoding method and apparatus are not limited to the above effects, and other effects not mentioned will be clear to those of ordinary skill in the art according to the following description. Description of the Drawings
[0017] To better understand the accompanying drawings referred to herein, a brief description of each drawing is provided.
[0018] Figure 1 is a block diagram of an image decoding apparatus according to an embodiment.
[0019] Figure 2 is a block diagram of an image encoding apparatus according to an embodiment.
[0020] Figure 3 illustrates a process of determining at least one coding unit by dividing a current coding unit according to an embodiment.
[0021] Figure 4 illustrates a process of determining at least one coding unit by dividing a non-square coding unit according to an embodiment.
[0022] Figure 5 Shows a process of dividing a coding unit based on at least one of block shape information and partitioning shape mode information according to an embodiment.
[0023] Figure 6 Shows a method of determining a specific coding unit among an odd number of coding units according to an embodiment.
[0024] Figure 7 Shows an order of processing a plurality of coding units when an image decoding apparatus determines a plurality of coding units by partitioning a current coding unit according to an embodiment.
[0025] Figure 8 Shows a process of determining that a current coding unit is to be divided into an odd number of coding units when the coding units cannot be processed in a specific order according to an embodiment.
[0026] Figure 9 Shows a process of determining at least one coding unit by partitioning a first coding unit according to an embodiment.
[0027] Figure 10 Shows that when a second coding unit having a non-square shape determined when a first coding unit is partitioned satisfies a specific condition according to an embodiment, the shape into which the second coding unit can be divided is restricted.
[0028] Figure 11 Shows a process of partitioning a square coding unit when the partitioning shape mode information indicates that the square coding unit is not partitioned into four square coding units according to an embodiment.
[0029] Figure 12 Shows that the processing order between a plurality of coding units can vary according to the process of partitioning the coding units according to an embodiment.
[0030] Figure 13 Shows a process of determining the depth of a coding unit as the shape and size of the coding unit change when the coding unit is recursively partitioned to determine a plurality of coding units according to an embodiment.
[0031] Figure 14 Shows the depth that can be determined based on the shape and size of the coding unit, and a partial index (PID) for distinguishing parts of the coding unit according to an embodiment.
[0032] Figure 15 Shows determining a plurality of coding units based on a plurality of preset data units included in a picture according to an embodiment.
[0033] Figure 16Shows coding units that can be determined for each picture when the combination of shapes into which a coding unit can be divided is different for each picture, according to an embodiment.
[0034] Figure 17 Shows various shapes of coding units that can be determined based on partitioning shape pattern information that can be represented as a binary code, according to an embodiment.
[0035] Figure 18 Shows other shapes of coding units that can be determined based on partitioning shape pattern information that can be represented as a binary code, according to an embodiment.
[0036] Figure 19 Is a block diagram of an image encoding and decoding system that performs loop filtering.
[0037] Figure 20 Is a block diagram showing the configuration of an image decoding device according to an embodiment.
[0038] Figure 21 Is a diagram showing an image sequence having any of various shapes.
[0039] Figure 22 Is a diagram showing the positions of neighboring blocks related to a current block.
[0040] Figure 23 Is a table showing a candidate list.
[0041] Figure 24 Shows a method of selecting a reference sample when the size of a reference image is the same as the size of a current image.
[0042] Figure 25 Shows a method of selecting a reference sample when the size of a reference image is different from the size of a current image.
[0043] Figure 26 Is a table showing filter coefficients of an n-tap filter according to the size ratio between a current image and a reference image.
[0044] Figure 27A Is a diagram for describing a method of generating a filtered sample by filtering a reference sample.
[0045] Figure 27B Is a diagram for describing a method of generating a filtered sample by filtering a reference sample.
[0046] Figure 27C Is a diagram for describing a method of generating a filtered sample by filtering a reference sample.
[0047] Figure 27DA diagram for describing a method of generating a filtered sample by filtering a reference sample.
[0048] Figure 28 A diagram for describing a method of generating a predicted sample when the size of a reference image is different from the size of a current image.
[0049] Figure 29 A diagram showing Figure 28 A table of filter coefficients of an n-tap filter for filtering a reference sample.
[0050] Figure 30 A flowchart for describing an image decoding method according to an embodiment.
[0051] Figure 31 A block diagram showing the configuration of an image encoding apparatus according to an embodiment.
[0052] Figure 32 A flowchart for describing an image encoding method according to an embodiment. Detailed Description of the Invention
[0053] An image decoding method according to an embodiment includes: comparing the size of a current image including a current block with the size of a reference image; selecting, based on the motion vector of the current block, a reference sample corresponding to a current sample in the current block in the reference image; and reconstructing the current block based on the reference sample, wherein when the size of the reference image is larger than the size of the current image, the reference samples are spaced apart from each other by an interval corresponding to the result of the size comparison in the reference image.
[0054] The reconstruction of the current block may include: generating a filtered sample corresponding to the reference sample by applying an n-tap filter (n is a natural number) to the reference sample; and determining a predicted sample of the current sample from the filtered sample, wherein the filter coefficients of the n-tap filter are selected according to the result of the size comparison.
[0055] When the size of the current image is the same as the size of the reference image, the n-tap filter may not be applied to the reference sample, and the predicted sample may be determined from the reference sample.
[0056] The selection of the reference sample may include: determining a position by applying the motion vector of the current block to the position of the upper-left current sample among the current samples; changing the determined position according to the result of the size comparison; and selecting an upper-left reference sample corresponding to the changed position and remaining reference samples spaced apart from the upper-left reference sample by an interval corresponding to the result of the size comparison.
[0057] The image decoding method may further include: configuring a reference image list including images having a size equal to or larger than the size of the current image among the images decoded before the current image is decoded; and selecting a reference image from the images included in the reference image list.
[0058] The image decoding method may further include: determining whether an image having the same size as the size of the current image is stored in a decoded picture buffer (DPB); when an image having the same size is stored in the DPB, configuring a candidate list of motion vectors of temporal blocks in collocated images that are decoded earlier than the current image as candidate motion vectors; and determining a motion vector of a current block based on a candidate motion vector selected from among the candidate motion vectors included in the candidate list.
[0059] When an image having the same size as the size of the current image is not stored in the DPB, the motion vectors of the temporal blocks may not be included in the candidate list.
[0060] An image decoding apparatus according to an embodiment includes a prediction decoder configured to compare a size of a current image including a current block with a size of a reference image; select a reference sample corresponding to a current sample in the current block in the reference image according to a motion vector of the current block; and reconstruct the current block based on the reference sample, wherein when the size of the reference image is larger than the size of the current image, the reference samples are spaced apart from each other by an interval corresponding to a result of the size comparison in the reference image.
[0061] An image encoding method according to an embodiment includes: comparing a size of a current image including a current block with a size of a reference image; selecting a reference sample corresponding to a current sample in the current block in the reference image; and encoding a motion vector indicating the reference sample, wherein when the size of the reference image is larger than the size of the current image, the reference samples are spaced apart from each other by an interval corresponding to a result of the size comparison in the reference image.
[0062] An image encoding apparatus according to an embodiment includes a prediction encoder configured to compare a size of a current image including a current block with a size of a reference image; select a reference sample corresponding to a current sample in the current block in the reference image; and encode a motion vector indicating the reference sample, wherein when the size of the reference image is larger than the size of the current image, the reference samples are spaced apart from each other by an interval corresponding to a result of the size comparison in the reference image.
[0063] Since the present disclosure allows for various variations and numerous embodiments, exemplary embodiments will be shown in the drawings and described in detail in the written description. However, this is not intended to limit the present disclosure to a specific practice mode, and it should be understood that all variations, equivalents, and alternatives that do not depart from the spirit and technical scope of the present disclosure are included in the present disclosure.
[0064] In the description of the embodiments, when it is considered that specific detailed explanations of related technologies may unnecessarily obscure the essence of the present disclosure, these detailed explanations are omitted. In addition, the numbers used in the description of the specification (e.g., first and second) are merely identifier codes for distinguishing one component from another.
[0065] In addition, in the specification, it should be understood that when elements are "connected" or "coupled" to each other, the elements can be directly connected or coupled to each other, but they can also be connected or coupled to each other through intermediate elements therebetween, unless otherwise stated.
[0066] In the specification, regarding components represented as "parts (units)" or "modules", two or more components can be combined into one component, or one component can be divided into two or more components according to the subdivided functions. In addition, in addition to its own main function, each component described below can also perform some or all of the functions performed by other components, and some of the main functions of each component can be completely performed by other components.
[0067] In addition, the terms "image" or "picture" used herein can refer to a still image or a moving image of a video, that is, the video itself.
[0068] In addition, the terms "sample" or "signal" used herein refer to data that is assigned to a sampling position of an image and to be processed. For example, the pixel value of an image in the spatial domain or the transform coefficient in the transform domain can be a sample. A unit including one or more samples can be defined as a block.
[0069] Hereinafter, reference will be made to Figures 1 to 19 Disclose an image encoding method and apparatus and an image decoding method and apparatus for a tree structure-based coding unit and a transform unit according to an embodiment.
[0070] Figure 1 is a block diagram of an image decoding apparatus 100 according to an embodiment.
[0071] The image decoding apparatus 100 may include a bitstream acquirer 110 and a decoder 120. The bitstream acquirer 110 and the decoder 120 may include at least one processor. In addition, the bitstream acquirer 110 and the decoder 120 may include a memory that stores instructions to be executed by at least one processor.
[0072] The bitstream acquirer 110 can receive a bitstream. The bitstream can include information generated by image encoding of the image encoding device 200, which will be described below. In addition, the bitstream can be sent from the image encoding device 200. The image decoding device 100 can be connected to the image encoding device 200 in a wired or wireless manner, and the bitstream acquirer 110 can receive the bitstream in a wired or wireless manner. The bitstream acquirer 110 can receive the bitstream from a storage medium such as an optical medium or a hard disk. The decoder 120 can reconstruct an image based on the information obtained from the received bitstream. The decoder 120 can obtain syntax elements for reconstructing the image from the bitstream. The decoder 120 can reconstruct the image based on the syntax elements.
[0073] The operation of the image decoding device 100 will be described in detail below. The bitstream acquirer 110 can receive a bitstream.
[0074] The image decoding device 100 can perform an operation of obtaining a bin (binary character) string corresponding to the partitioning shape mode of the coding unit from the bitstream. Then, the image decoding device 100 can perform an operation of determining the partitioning rule of the coding unit. In addition, the image decoding device 100 can perform an operation of partitioning the coding unit into a plurality of coding units based on at least one of the bin string corresponding to the partitioning shape mode and the partitioning rule. The image decoding device 100 can determine a first range that is the allowable size range of the coding unit according to the aspect ratio of the coding unit in order to determine the partitioning rule. The image decoding device 100 can determine a second range that is the allowable size range of the coding unit according to the partitioning shape mode of the coding unit in order to determine the partitioning rule.
[0075] Hereinafter, the partitioning of the coding unit will be described in detail according to an embodiment of the present disclosure.
[0076] First, a picture can be partitioned into one or more slices or one or more tiles. A slice or a tile can be a sequence of one or more largest coding units (coding tree units (CTUs)). According to an embodiment, a slice can include one or more tiles, and a slice can include one or more largest coding units. A slice including one tile or a plurality of tiles can be determined in the picture.
[0077] As a concept compared with the largest coding unit (CTU), there is a largest coding block (coding tree block (CTB)). The largest coding block (CTB) represents an NxN block including NxN samples (N is an integer). Each color component can be partitioned into one or more largest coding blocks.
[0078] When a picture has three sample arrays (sample arrays of Y, Cr, and Cb components), a largest coding unit (CTU) includes a largest coding block of luminance samples, two corresponding largest coding blocks of chrominance samples, and a syntax structure for coding the luminance samples and the chrominance samples. When the picture is a monochrome picture, the largest coding unit includes a largest coding block of monochrome samples and a syntax structure for coding the monochrome samples. When the picture is a picture coded in color planes separated according to color components, the largest coding unit includes a syntax structure for coding the picture and the samples of the picture.
[0079] A largest coding block (CTB) may be partitioned into MxN coding blocks each including MxN samples (M and N are integers).
[0080] When a picture has sample arrays of Y, Cr, and Cb components, a coding unit (CU) includes a coding block of luminance samples, two corresponding coding blocks of chrominance samples, and a syntax structure for coding the luminance samples and the chrominance samples. When the picture is a monochrome picture, the coding unit includes a coding block of monochrome samples and a syntax structure for coding the monochrome samples. When the picture is a picture coded in color planes separated according to color components, the coding unit includes a syntax structure for coding the picture and the samples of the picture.
[0081] As described above, the largest coding block and the largest coding unit are conceptually distinct from each other, and the coding block and the coding unit are conceptually distinct from each other. That is, a (largest) coding unit refers to a data structure including a (largest) coding block (which includes corresponding samples) and a syntax structure corresponding to the (largest) coding block. However, since those of ordinary skill in the art understand that a (largest) coding unit or a (largest) coding block refers to a block of a specific size including a specific number of samples, in the following description, the largest coding block and the largest coding unit, or the coding block and the coding unit, are referred to without distinction, unless otherwise specified.
[0082] An image may be partitioned into largest coding units (CTUs). The size of each largest coding unit may be determined based on information obtained from a bitstream. The shape of each largest coding unit may be a square shape of the same size. However, the embodiments are not limited thereto.
[0083] For example, information about the maximum size of a luminance coding block may be obtained from the bitstream. For example, the maximum size of the luminance coding block indicated by the information about the maximum size of the luminance coding block may be one of 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, and 256x256.
[0084] For example, information about the difference in luminance block size and the maximum size of a luminance coding block that can be divided into two can be obtained from a bitstream. The information about the difference in luminance block size may refer to the size difference between the largest luminance coding unit and the largest luminance coding block that can be divided into two. Thus, when the information about the maximum size of a luminance coding block that can be divided into two and the information about the difference in luminance block size obtained from the bitstream are combined with each other, the size of the largest luminance coding unit can be determined. The size of the largest chrominance coding unit can be determined by using the size of the largest luminance coding unit. For example, when the Y:Cb:Cr ratio is 4:2:0 according to the color format, the size of a chrominance block may be half of the size of a luminance block, and the size of the largest chrominance coding unit may be half of the size of the largest luminance coding unit.
[0085] According to an embodiment, since the information about the maximum size of a luminance coding block that can be binary-divided is obtained from a bitstream, the maximum size of a luminance coding block that can be binary-divided can be variably determined. Conversely, the maximum size of a luminance coding block that can be ternary-divided may be fixed. For example, the maximum size of a luminance coding block that can be ternary-divided in an I picture may be 32x32, while the maximum size of a luminance coding block that can be ternary-divided in a P picture or a B picture may be 64x64.
[0086] In addition, a maximum coding unit may be hierarchically divided into coding units based on partitioning shape mode information obtained from a bitstream. At least one of information indicating whether quadsplitting is performed, information indicating whether multi-splitting is performed, partitioning direction information, and partitioning type information may be obtained from the bitstream as the partitioning shape mode information.
[0087] For example, the information indicating whether quadsplitting is performed may indicate whether the current coding unit is quadsplit (QUAD_SPLIT).
[0088] When the current coding unit is not quadsplit, the information indicating whether multi-splitting is performed may indicate whether the current coding unit is no longer split (NO_SPLIT) or whether it is binary-divided / ternary-divided.
[0089] When the current coding unit is binary-divided or ternary-divided, the partitioning direction information indicates that the current coding unit is divided in one of the horizontal direction and the vertical direction.
[0090] When the current coding unit is divided in the horizontal direction or the vertical direction, the partitioning type information indicates that the current coding unit is binary-divided or ternary-divided.
[0091] The partitioning mode of the current coding unit can be determined according to the partitioning direction information and the partitioning type information. When the current coding unit is binary partitioned in the horizontal direction, the partitioning mode can be determined as the binary horizontal partitioning mode (SPLIT_BT_HOR). When the current coding unit is ternary partitioned in the horizontal direction, the partitioning mode can be determined as the ternary horizontal partitioning mode (SPLIT_TT_HOR). When the current coding unit is binary partitioned in the vertical direction, the partitioning mode can be determined as the binary vertical partitioning mode (SPLIT_BT_VER), and when the current coding unit is ternary partitioned in the vertical direction, the partitioning mode can be determined as the ternary vertical partitioning mode (SPLIT_TT_VER).
[0092] The image decoding apparatus 100 may obtain partitioning shape mode information from a bin string in the bitstream. The form of the bitstream received by the image decoding apparatus 100 may include fixed-length binary codes, unary codes, truncated unary codes, predetermined binary codes, etc. A bin string is information in binary numbers. A bin string may include at least one bit. The image decoding apparatus 100 may obtain partitioning shape mode information corresponding to the bin string based on partitioning rules. The image decoding apparatus 100 may determine whether to perform a quaternary partition on the coding unit, whether to perform a partition on the coding unit, the partitioning direction, and the partitioning type based on a bin string.
[0093] The coding unit may be less than or equal to the maximum coding unit. For example, since the maximum coding unit is the coding unit with the largest size, the maximum coding unit is one of the coding units. When the partitioning shape mode information about the maximum coding unit indicates that no partitioning is performed, the coding unit determined in the maximum coding unit has the same size as the maximum coding unit. When the partitioning shape mode information about the maximum coding unit indicates that partitioning is performed, the maximum coding unit may be partitioned into coding units. In addition, when the partitioning shape mode information about the coding unit indicates that partitioning is performed, the coding unit may be partitioned into smaller coding units. However, the partitioning of the image is not limited to this, and the maximum coding unit and the coding unit may not be distinguished. Reference will be made to Figures 3 to 16 describe the partitioning of the coding unit in more detail.
[0094] In addition, one or more prediction blocks for prediction can be determined from the coding unit. The prediction block may be equal to or smaller than the coding unit. In addition, one or more transform blocks for transformation can be determined from the coding unit. The transform block may be equal to or smaller than the coding unit.
[0095] The shapes and sizes of the transform block and the prediction block may not be related to each other.
[0096] In another embodiment, prediction may be performed by using a coding unit as a prediction unit. In addition, transformation may be performed by using a coding unit as a transform block.
[0097] Reference will be made Figures 3 to 16 to a more detailed description of the division of the coding unit. The current block and adjacent blocks of the present disclosure may indicate one of a largest coding unit, a coding unit, a prediction block, and a transform block. In addition, the current block or the current coding unit is the block that is currently being decoded or encoded or the block that is currently being divided. The adjacent block may be a block that has been reconstructed before the current block. The adjacent block may be adjacent to the current block in the spatial domain or the temporal domain. The adjacent block may be located at one of the lower left, left, upper left, upper, upper right, right, and lower right of the current block.
[0098] Figure 3 A process of determining at least one coding unit by dividing a current coding unit by an image decoding apparatus 100 according to an embodiment is shown.
[0099] The block shape may include 4Nx4N, 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN, or Nx8N. Here, N may be a positive integer. The block shape information is information indicating at least one of the shape, direction, aspect ratio, and size of the coding unit.
[0100] The shape of the coding unit may include a square and a non-square. When the width and height of the coding unit are the same (i.e., when the block shape of the coding unit is 4Nx4N), the image decoding apparatus 100 may determine the block shape information of the coding unit as a square. The image decoding apparatus 100 may determine the shape of the coding unit as a non-square.
[0101] When the width and height of the coding unit are different from each other (i.e., when the block shape of the coding unit is 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN, or Nx8N), the image decoding apparatus 100 may determine the block shape information of the coding unit as a non-square. When the shape of the coding unit is non-square, the image decoding apparatus 100 may determine the aspect ratio among the block shape information of the coding unit as at least one of 1:2, 2:1, 1:4, 4:1, 8:1, 1:16, 16:1, 1:32, and 32:1. In addition, the image decoding apparatus 100 may determine whether the coding unit is in the horizontal direction or the vertical direction based on the length of the width and the length of the height of the coding unit. In addition, the image decoding apparatus 100 may determine the size of the coding unit based on at least one of the length of the width, the length of the height, and the area of the coding unit.
[0102] According to an embodiment, the image decoding apparatus 100 may determine the shape of a coding unit by using block shape information, and may determine a method of dividing the coding unit by using partition shape mode information. That is, the coding unit division method indicated by the partition shape mode information may be determined based on the block shape indicated by the block shape information used by the image decoding apparatus 100.
[0103] The image decoding apparatus 100 may obtain the partition shape mode information from a bitstream. However, the embodiment is not limited thereto, and the image decoding apparatus 100 and the image encoding apparatus 200 may determine pre-agreed partition shape mode information based on the block shape information. The image decoding apparatus 100 may determine pre-agreed partition shape mode information regarding a largest coding unit or a smallest coding unit. For example, the image decoding apparatus 100 may determine the partition shape mode information regarding the largest coding unit as a quadtree partition. In addition, the image decoding apparatus 100 may determine the partition shape mode information regarding the smallest coding unit as "no division is performed". In particular, the image decoding apparatus 100 may determine the size of the largest coding unit as 256x256. The image decoding apparatus 100 may determine the pre-agreed partition shape mode information as a quadtree partition. A quadtree partition is a partition shape mode in which both the width and height of a coding unit are halved. The image decoding apparatus 100 may obtain a coding unit having a size of 128x128 from the largest coding unit having a size of 256x256 based on the partition shape mode information. In addition, the image decoding apparatus 100 may determine the size of the smallest coding unit as 4x4. The image decoding apparatus 100 may obtain partition shape mode information indicating "no division is performed" with respect to the smallest coding unit.
[0104] According to an embodiment, the image decoding apparatus 100 may use block shape information indicating that a current coding unit has a square shape. For example, the image decoding apparatus 100 may determine whether to divide a square coding unit, whether to vertically divide a square coding unit, whether to horizontally divide a square coding unit, or whether to divide a square coding unit into four coding units based on the partition shape mode information. Refer to Figure 3 , when the block shape information of the current coding unit 300 indicates a square shape, the decoder 120 may not divide a coding unit 310a having the same size as the current coding unit 300 based on the partition shape mode information indicating no division is performed, or may determine coding units 310b, 310c, 310d, 310e, or 310f divided based on the partition shape mode information indicating a specific division method.
[0105] Refer to Figure 3, according to an embodiment, the image decoding apparatus 100 may determine two coding units 310b obtained by dividing a current coding unit 300 in a vertical direction based on partition shape mode information indicating partition performed in the vertical direction. The image decoding apparatus 100 may determine two coding units 310c obtained by dividing the current coding unit 300 in a horizontal direction based on partition shape mode information indicating partition performed in the horizontal direction. The image decoding apparatus 100 may determine four coding units 310d obtained by dividing the current coding unit 300 in both the vertical and horizontal directions based on partition shape mode information indicating partition performed in both the vertical and horizontal directions. According to an embodiment, the image decoding apparatus 100 may determine three coding units 310e obtained by dividing the current coding unit 300 in a vertical direction based on partition shape mode information indicating ternary partition performed in the vertical direction. The image decoding apparatus 100 may determine three coding units 310f obtained by dividing the current coding unit 300 in a horizontal direction based on partition shape mode information indicating ternary partition performed in the horizontal direction. However, the method for dividing a square coding unit is not limited to the above method, and the partition shape mode information may indicate various methods. Specific partition methods for dividing a square coding unit will be described in detail through various embodiments below.
[0106] Figure 4 FIG. shows a process of the image decoding apparatus 100 according to an embodiment determining at least one coding unit by dividing a non-square coding unit.
[0107] According to an embodiment, the image decoding apparatus 100 may use block shape information indicating that the current coding unit has a non-square shape. The image decoding apparatus 100 may determine whether not to divide the non-square current coding unit or whether to divide the non-square current coding unit by using a specific partition method based on the partition shape mode information. Refer to Figure 4 , when the block shape information of the current coding unit 400 or 450 indicates a non-square shape, the image decoding apparatus 100 may determine a coding unit 410 or 460 having the same size as the current coding unit 400 or 450 based on the partition shape mode information indicating no partition, or may determine coding units 420a and 420b, 430a to 430c, 470a and 470b, or 480a to 480c divided based on the partition shape mode information indicating a specific partition method. Specific partition methods for dividing a non-square coding unit will be described in detail through various embodiments below.
[0108] According to an embodiment, the image decoding apparatus 100 may determine a division method of a coding unit by using division shape mode information, and in this case, the division shape mode information may indicate the number of one or more coding units generated by dividing the coding unit. Refer to Figure 4 , when the division shape mode information indicates that the current coding unit 400 or 450 is divided into two coding units, the image decoding apparatus 100 may determine two coding units 420a and 420b or 470a and 470b included in the current coding unit 400 or 450 by dividing the current coding unit 400 or 450 based on the division shape mode information.
[0109] According to an embodiment, when the image decoding apparatus 100 divides a non-square current coding unit 400 or 450 based on the division shape mode information, the image decoding apparatus 100 may consider the position of the long side of the non-square current coding unit 400 or 450 to divide the current coding unit. For example, considering the shape of the current coding unit 400 or 450, the image decoding apparatus 100 may determine a plurality of coding units by dividing the current coding unit 400 or 450 in the direction of the long side of the current coding unit 400 or 450.
[0110] According to an embodiment, when the division shape mode information indicates that a coding unit is divided (ternary division) into an odd number of blocks, the image decoding apparatus 100 may determine an odd number of coding units included in the current coding unit 400 or 450. For example, when the division shape mode information indicates that the current coding unit 400 or 450 is divided into three coding units, the image decoding apparatus 100 may divide the current coding unit 400 or 450 into three coding units 430a, 430b, and 430c or 480a, 480b, and 480c.
[0111] According to an embodiment, the aspect ratio of the current coding unit 400 or 450 may be 4:1 or 1:4. When the aspect ratio is 4:1, the block shape information may indicate the horizontal direction because the length of the width is longer than the length of the height. When the aspect ratio is 1:4, the block shape information may indicate the vertical direction because the length of the width is shorter than the length of the height. The image decoding apparatus 100 may determine to divide the current coding unit into an odd number of blocks based on the partitioning shape mode information. In addition, the image decoding apparatus 100 may determine the partitioning direction of the current coding unit 400 or 450 based on the block shape information of the current coding unit 400 or 450. For example, when the current coding unit 400 is in the vertical direction, the image decoding apparatus 100 may determine coding units 430a, 430b, and 430c by partitioning the current coding unit 400 in the horizontal direction. In addition, when the current coding unit 450 is in the horizontal direction, the image decoding apparatus 100 may determine coding units 480a, 480b, and 480c by partitioning the current coding unit 450 in the vertical direction.
[0112] According to an embodiment, the image decoding apparatus 100 may determine an odd number of coding units included in the current coding unit 400 or 450, and not all of the determined coding units may have the same size. For example, a specific coding unit 430b or 480b among the determined odd number of coding units 430a, 430b, and 430c or 480a, 480b, and 480c may have a different size from the other coding units 430a and 430c or 480a and 480c. That is, the coding units that can be determined by partitioning the current coding unit 400 or 450 may have various sizes, and in some cases, all of the odd number of coding units 430a, 430b, and 430c or 480a, 480b, and 480c may have different sizes.
[0113] According to an embodiment, when the partitioning shape mode information indicates that the coding unit is to be divided into an odd number of blocks, the image decoding apparatus 100 may determine an odd number of coding units included in the current coding unit 400 or 450, and in addition, a specific restriction may be imposed on at least one of the odd number of coding units generated by partitioning the current coding unit 400 or 450. Refer to Figure 4, the image decoding apparatus 100 may set a decoding process for a coding unit 430b or 480b that is centered among three coding units 430a, 430b, and 430c or 480a, 480b, and 480c (which is generated when the current coding unit 400 or 450 is divided differently from the other coding units 430a and 430c or 480a and 480c). For example, different from the other coding units 430a and 430c or 480a and 480c, the image decoding apparatus 100 may limit the coding unit 430b or 480b at the center position from being further divided or only divided a specific number of times.
[0114] Figure 5 FIG. shows a process in which the image decoding apparatus 100 according to an embodiment divides a coding unit based on at least one of block shape information and division shape mode information.
[0115] According to an embodiment, the image decoding apparatus 100 may determine whether to divide a square first coding unit 500 into coding units based on at least one of block shape information and division shape mode information. According to an embodiment, when the division shape mode information indicates dividing the first coding unit 500 in the horizontal direction, the image decoding apparatus 100 may determine a second coding unit 510 by dividing the first coding unit 500 in the horizontal direction. The first coding unit, second coding unit, and third coding unit used according to an embodiment are terms for understanding the relationship before and after dividing the coding unit. For example, the second coding unit may be determined by dividing the first coding unit, and the third coding unit may be determined by dividing the second coding unit. It should be understood that the relationship between the first coding unit, second coding unit, and third coding unit follows the above description.
[0116] According to an embodiment, the image decoding apparatus 100 may determine whether to divide the determined second coding unit 510 into coding units based on the division shape mode information. Refer to Figure 5, based on the partitioning shape mode information, the image decoding device 100 may or may not partition the non-square second coding unit 510 determined by partitioning the first coding unit 500 into one or more third coding units 520a, 520b, 520c, and 520d. The image decoding device 100 may obtain the partitioning shape mode information, and may obtain a plurality of second coding units (e.g., 510) of various shapes by partitioning the first coding unit 500 based on the obtained partitioning shape mode information, and may partition the second coding unit 510 by using the partitioning method of the first coding unit 500 based on the partitioning shape mode information. According to an embodiment, when the first coding unit 500 is partitioned into the second coding unit 510 based on the partitioning shape mode information of the first coding unit 500, the second coding unit 510 may also be partitioned into third coding units (e.g., 520a or 520b, 520c, and 520d) based on the partitioning shape mode information of the second coding unit 510. That is, the coding units may be recursively partitioned based on the partitioning shape mode information of each coding unit. Therefore, square coding units may be determined by partitioning non-square coding units, and non-square coding units may be determined by recursively partitioning square coding units.
[0117] Reference Figure 5 , a specific coding unit (e.g., a coding unit located at the center position or a square coding unit) among the odd-numbered third coding units 520b, 520c, and 520d determined by partitioning the non-square second coding unit 510 may be recursively partitioned. According to an embodiment, the non-square third coding unit 520b among the odd-numbered third coding units 520b, 520c, and 520d may be partitioned into a plurality of fourth coding units in the horizontal direction. The non-square fourth coding unit 530b or 530d among the plurality of fourth coding units 530a, 530b, 530c, and 530d may be re-partitioned into a plurality of coding units. For example, the non-square fourth coding unit 530b or 530d may be re-partitioned into an odd number of coding units. Methods that may be used to recursively partition coding units will be described below through various embodiments.
[0118] According to an embodiment, the image decoding apparatus 100 may divide each of the third coding units 520a, 520b, 520c, and 520d into coding units based on the partitioning shape mode information. In addition, the image decoding apparatus 100 may determine not to divide the second coding unit 510 based on the partitioning shape mode information. According to an embodiment, the image decoding apparatus 100 may divide the non-square second coding unit 510 into an odd number of third coding units 520b, 520c, and 520d. The image decoding apparatus 100 may impose a specific restriction on a specific third coding unit among the odd number of third coding units 520b, 520c, and 520d. For example, the image decoding apparatus 100 may restrict the third coding unit 520c at the central position among the odd number of third coding units 520b, 520c, and 520d from being further divided or from being divided a settable number of times.
[0119] Reference Figure 5 , the image decoding apparatus 100 may restrict the third coding unit 520c at the central position among the odd number of third coding units 520b, 520c, and 520d included in the non-square second coding unit 510 from being further divided, from being divided by using a specific partitioning method (e.g., only divided into four coding units or divided by using the partitioning method of the second coding unit 510), or from being divided only a specific number of times (e.g., only divided n times (where n > 0)). However, the restriction on the third coding unit 520c at the central position is not limited to the above examples and may include various restrictions on decoding the third coding unit 520c at the central position that are different from those of the other third coding units 520b and 520d.
[0120] According to an embodiment, the image decoding apparatus 100 may obtain partitioning shape mode information for partitioning a current coding unit from a specific position in the current coding unit.
[0121] Figure 6 FIG. shows a method in which the image decoding apparatus 100 determines a specific coding unit among an odd number of coding units according to an embodiment.
[0122] Reference Figure 6 , the partitioning shape mode information of the current coding unit 600 or 650 may be obtained from a sample at a specific position (e.g., the sample 640 or 690 at the central position) among a plurality of samples included in the current coding unit 600 or 650. However, the specific position from which at least one piece of partitioning shape mode information can be obtained in the current coding unit 600 is not limited to Figure 6at the central position in, and may include various positions included in the current coding unit 600 (e.g., top, bottom, left, right, upper left, lower left, upper right, lower right positions, etc.). The image decoding apparatus 100 may obtain partition shape mode information from a specific position and may determine whether to partition the current coding unit into coding units of various shapes and various sizes.
[0123] According to an embodiment, when the current coding unit is partitioned into a specific number of coding units, the image decoding apparatus 100 may select one of the coding units. Various methods may be used to select one of the multiple coding units, which will be described below through various embodiments.
[0124] According to an embodiment, the image decoding apparatus 100 may partition the current coding unit into multiple coding units and may determine a coding unit at a specific position.
[0125] According to an embodiment, the image decoding apparatus 100 may use information indicating the positions of an odd number of coding units to determine a coding unit at the central position among the odd number of coding units. Referring to Figure 6 , the image decoding apparatus 100 may determine an odd number of coding units 620a, 620b, and 620c or an odd number of coding units 660a, 660b, and 660c by partitioning the current coding unit 600 or the current coding unit 650. The image decoding apparatus 100 may determine the middle coding unit 620b or the middle coding unit 660b by using information about the positions of the odd number of coding units 620a, 620b, and 620c or the odd number of coding units 660a, 660b, and 660c. For example, the image decoding apparatus 100 may determine the positions of the coding units 620a, 620b, and 620c based on information indicating the positions of specific samples included in the coding units 620a, 620b, and 620c, thereby determining the coding unit 620b at the central position. Specifically, the image decoding apparatus 100 may determine the positions of the coding units 620a, 620b, and 620c based on information indicating the positions of the upper left samples 630a, 630b, and 630c of the coding units 620a, 620b, and 620c, thereby determining the coding unit 620b at the central position.
[0126] According to an embodiment, the information indicating the positions of the upper-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, may include information about the positions or coordinates of the coding units 620a, 620b, and 620c in the picture. According to an embodiment, the information indicating the positions of the upper-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, may include information indicating the width or height of the coding units 620a, 620b, and 620c included in the current coding unit 600, and the width or height may correspond to the information indicating the difference between the coordinates of the coding units 620a, 620b, and 620c in the picture. That is, the image decoding device 100 may determine the coding unit 620b at the center position by directly using the information about the positions or coordinates of the coding units 620a, 620b, and 620c in the picture, or by using the information about the width or height of the coding unit (which corresponds to the difference value between the coordinates).
[0127] According to an embodiment, the information indicating the position of the upper-left sample 630a of the upper coding unit 620a may include the coordinates (xa, ya), the information indicating the position of the upper-left sample 630b of the middle coding unit 620b may include the coordinates (xb, yb), and the information indicating the position of the upper-left sample 630c of the lower coding unit 620c may include the coordinates (xc, yc). The image decoding device 100 may determine the middle coding unit 620b by using the coordinates of the upper-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively. For example, when the coordinates of the upper-left samples 630a, 630b, and 630c are sorted in ascending or descending order, the coding unit 620b including the sample 630b coordinates (xb, yb) at the center position may be determined as the coding unit at the center position among the coding units 620a, 620b, and 620c determined by dividing the current coding unit 600. However, the coordinates indicating the positions of the upper-left samples 630a, 630b, and 630c may include the coordinates indicating the absolute positions in the picture, or may use the coordinates (dxb, dyb) indicating the relative position of the upper-left sample 630b of the middle coding unit 620b with respect to the upper-left sample 630a of the upper coding unit 620a and the coordinates (dxc, dyc) indicating the relative position of the upper-left sample 630c of the lower coding unit 620c with respect to the upper-left sample 630a of the upper coding unit 620a. The method of determining the coding unit at a specific position by using the coordinates of the samples included in the coding unit as the information indicating the positions of the samples is not limited to the above method, and may include various arithmetic methods capable of using the coordinates of the samples.
[0128] According to an embodiment, the image decoding apparatus 100 may divide the current coding unit 600 into a plurality of coding units 620a, 620b, and 620c, and may select one of the coding units 620a, 620b, and 620c based on a specific criterion. For example, the image decoding apparatus 100 may select the coding unit 620b having a size different from that of the other coding units from among the coding units 620a, 620b, and 620c.
[0129] According to an embodiment, the image decoding apparatus 100 may determine the width or height of each of the coding units 620a, 620b, and 620c by using the coordinates (xa, ya), the coordinates (xb, yb), and the coordinates (xc, yc), where the coordinates (xa, ya) are information indicating the position of the upper left sample 630a of the upper coding unit 620a, the coordinates (xb, yb) are information indicating the position of the upper left sample 630b of the middle coding unit 620b, and the coordinates (xc, yc) are information indicating the position of the upper left sample 630c of the lower coding unit 620c. The image decoding apparatus 100 may determine the respective sizes of the coding units 620a, 620b, and 620c by using the coordinates (xa, ya), (xb, yb), and (xc, yc) indicating the positions of the coding units 620a, 620b, and 620c. According to an embodiment, the image decoding apparatus 100 may determine the width of the upper coding unit 620a as the width of the current coding unit 600. The image decoding apparatus 100 may determine the height of the upper coding unit 620a as yb - ya. According to an embodiment, the image decoding apparatus 100 may determine the width of the middle coding unit 620b as the width of the current coding unit 600. The image decoding apparatus 100 may determine the height of the middle coding unit 620b as yc - yb. According to an embodiment, the image decoding apparatus 100 may determine the width or height of the lower coding unit 620c by using the width or height of the current coding unit 600 and the widths or heights of the upper coding unit 620a and the middle coding unit 620b. The image decoding apparatus 100 may determine a coding unit having a size different from that of the other coding units based on the determined widths and heights of the coding units 620a, 620b, and 620c. Referring Figure 6 , the image decoding apparatus 100 may determine the middle coding unit 620b having a size different from that of the upper coding unit 620a and the lower coding unit 620c as the coding unit at a specific position. However, the above process in which the image decoding apparatus 100 determines a coding unit having a size different from that of the other coding units only corresponds to an example of determining a coding unit at a specific position by using the sizes of the coding units determined based on sample-based coordinates, and thus various processes of determining a coding unit at a specific position by comparing the sizes of the coding units determined based on specific sample-based coordinates may be used.
[0130] The image decoding device 100 can determine the width or height of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd) which are the information indicating the position of the upper left sample 670a of the left coding unit 660a, the coordinates (xe, ye) which are the information indicating the position of the upper left sample 670b of the middle coding unit 660b, and the coordinates (xf, yf) which are the information indicating the position of the upper left sample 670c of the right coding unit 660c. The image decoding device 100 can determine the respective sizes of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd), (xe, ye), and (xf, yf) indicating the positions of the coding units 660a, 660b, and 660c.
[0131] According to an embodiment, the image decoding device 100 can determine the width of the left coding unit 660a as xe - xd. The image decoding device 100 can determine the height of the left coding unit 660a as the height of the current coding unit 650. According to an embodiment, the image decoding device 100 can determine the width of the middle coding unit 660b as xf - xe. The image decoding device 100 can determine the height of the middle coding unit 660b as the height of the current coding unit 650. According to an embodiment, the image decoding device 100 can determine the width or height of the right coding unit 660c by using the width or height of the current coding unit 650 and the widths or heights of the left coding unit 660a and the middle coding unit 660b. The image decoding device 100 can determine a coding unit having a size different from the sizes of other coding units based on the determined widths and heights of the coding units 660a, 660b, and 660c. Refer Figure 6 , the image decoding device 100 can determine the middle coding unit 660b having a size different from that of the left coding unit 660a and the right coding unit 660c as a coding unit at a specific position. However, the above process in which the image decoding device 100 determines a coding unit having a size different from that of other coding units only corresponds to an example of determining a coding unit at a specific position by using the sizes of coding units determined based on sample-based coordinates. Therefore, various processes of determining a coding unit at a specific position by comparing the sizes of coding units determined based on specific sample-based coordinates can be used.
[0132] However, the position of the sample considered for determining the position of the coding unit is not limited to the above upper left position, and information about any position of the samples included in the coding unit can be used.
[0133] According to an embodiment, the image decoding apparatus 100 may select a coding unit at a specific position from among an odd number of coding units determined by dividing a current coding unit by considering the shape of the current coding unit. For example, when the current coding unit has a non-square shape with a width longer than its height, the image decoding apparatus 100 may determine a coding unit at a specific position in the horizontal direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions in the horizontal direction and may impose a restriction on the coding unit. When the current coding unit has a non-square shape with a height longer than its width, the image decoding apparatus 100 may determine a coding unit at a specific position in the vertical direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions in the vertical direction and may impose a restriction on the coding unit.
[0134] According to an embodiment, the image decoding apparatus 100 may use information indicating the respective positions of an even number of coding units to determine a coding unit at a specific position from among the even number of coding units. The image decoding apparatus 100 may determine the even number of coding units by dividing (binary partitioning) the current coding unit and may determine a coding unit at a specific position by using information about the positions of the even number of coding units. Operations related thereto may correspond to operations of determining a coding unit at a specific position (e.g., a center position) from among an odd number of coding units, which have been described in detail above with reference to Figure 6 This has been described in detail, and thus a detailed description thereof will be omitted.
[0135] According to an embodiment, when a non-square current coding unit is divided into a plurality of coding units, specific information about a coding unit at a specific position may be used in the dividing operation to determine a coding unit at a specific position from among the plurality of coding units. For example, the image decoding apparatus 100 may use at least one of block shape information and division shape mode information stored in samples included in an intermediate coding unit in the dividing operation to determine a coding unit at the center position from among the plurality of coding units determined by dividing the current coding unit.
[0136] Reference Figure 6, the image decoding apparatus 100 may divide a current coding unit 600 into a plurality of coding units 620a, 620b, and 620c based on partition shape mode information, and may determine the coding unit 620b at the center position among the plurality of coding units 620a, 620b, and 620c. In addition, considering the position from which the partition shape mode information is obtained, the image decoding apparatus 100 may determine the coding unit 620b at the center position. That is, the partition shape mode information of the current coding unit 600 may be obtained from the sample 640 at the center position of the current coding unit 600, and when the current coding unit 600 is divided into a plurality of coding units 620a, 620b, and 620c based on the partition shape mode information, the coding unit 620b including the sample 640 may be determined as the coding unit at the center position. However, the information for determining the coding unit at the center position is not limited to the partition shape mode information, and various types of information may be used to determine the coding unit at the center position.
[0137] According to an embodiment, specific information for identifying a coding unit at a specific position may be obtained from a specific sample included in the coding unit to be determined. Refer to Figure 6 , the image decoding apparatus 100 may use the partition shape mode information obtained from a sample at a specific position in the current coding unit 600 (e.g., the sample at the center position of the current coding unit 600) to determine the coding unit at the specific position (e.g., the coding unit at the center position among the plurality of divided coding units) among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600. That is, the image decoding apparatus 100 may determine the sample at the specific position by considering the block shape of the current coding unit 600, may determine the coding unit 620b including the sample from which specific information (e.g., partition shape mode information) can be obtained among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600, and may impose a specific restriction on the coding unit 620b. Refer to Figure 6 , according to an embodiment, during the decoding process, the image decoding apparatus 100 may determine the sample 640 at the center position of the current coding unit 600 as the sample from which specific information can be obtained, and may impose a specific restriction on the coding unit 620b including the sample 640. However, the position of the sample from which specific information can be obtained is not limited to the above position, and may include any position of the sample included in the coding unit 620b determined for the restriction.
[0138] According to an embodiment, the position of a sample from which specific information is obtained may be determined based on the shape of the current coding unit 600. According to an embodiment, the block shape information may indicate whether the current coding unit is a square shape or a non-square shape, and the position of a sample from which specific information is obtained may be determined based on the shape. For example, the image decoding apparatus 100 may determine, as a sample from which specific information can be obtained, a sample located at a boundary for dividing at least one of the width and the height of the current coding unit into two halves by using at least one of the information on the width of the current coding unit and the information on the height of the current coding unit. As another example, when the block shape information of the current coding unit indicates a non-square shape, the image decoding apparatus 100 may determine, as a sample from which specific information can be obtained, one of the samples adjacent to the boundary for dividing the long side of the current coding unit into two halves.
[0139] According to an embodiment, when the current coding unit is divided into a plurality of coding units, the image decoding apparatus 100 may use the division shape mode information to determine a coding unit at a specific position among the plurality of coding units. According to an embodiment, the image decoding apparatus 100 may obtain the division shape mode information from a sample at a specific position in the coding unit, and may divide the plurality of coding units generated by dividing the current coding unit by using the division shape mode information obtained from the samples at the specific positions in each of the plurality of coding units. That is, the coding unit may be recursively divided based on the division shape mode information obtained from the samples at the specific positions in each coding unit. The process of recursively dividing the coding unit has been described above with reference to Figure 5 and thus a detailed description thereof will be omitted.
[0140] According to an embodiment, the image decoding apparatus 100 may determine one or more coding units by dividing the current coding unit, and may determine the order of decoding the one or more coding units based on a specific block (e.g., the current coding unit).
[0141] Figure 7 FIG. shows the order of processing a plurality of coding units when the image decoding apparatus 100 determines a plurality of coding units by dividing the current coding unit according to an embodiment.
[0142] According to an embodiment, based on the division shape mode information, the image decoding apparatus 100 may determine second coding units 710a and 710b by dividing a first coding unit 700 in a vertical direction, may determine second coding units 730a and 730b by dividing the first coding unit 700 in a horizontal direction, or may determine second coding units 750a, 750b, 750c, and 750d by dividing the first coding unit 700 in both the vertical direction and the horizontal direction.
[0143] Reference Figure 7 ,the image decoding device 100 may determine to process the second coding units 710a and 710b determined by dividing the first coding unit 700 in the vertical direction in a horizontal direction order 710c. The image decoding device 100 may determine to process the second coding units 730a and 730b determined by dividing the first coding unit 700 in the horizontal direction in a vertical direction order 730c. The image decoding device 100 may determine the second coding units 750a, 750b, 750c, and 750d determined by dividing the first coding unit 700 in the vertical and horizontal directions according to a specific order of processing the coding units in one row and then processing the coding units in the next row (e.g., raster scan order or Z-scan order 750e).
[0144] According to an embodiment, the image decoding device 100 may recursively divide the coding unit. Reference Figure 7 ,the image decoding device 100 may determine a plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c, and 750d by dividing the first coding unit 700, and may recursively divide each of the determined plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d. The dividing method of the plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c, and 750d may correspond to the dividing method of the first coding unit 700. Therefore, each of the plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c, and 750d may be independently divided into a plurality of coding units. Reference Figure 7 ,the image decoding device 100 may determine the second coding units 710a and 710b by dividing the first coding unit 700 in the vertical direction, and may determine to independently divide or not divide each of the second coding units 710a and 710b.
[0145] According to an embodiment, the image decoding device 100 may determine the third coding units 720a and 720b by dividing the second coding unit 710a on the left in the horizontal direction, and may not divide the second coding unit 710b on the right.
[0146] According to an embodiment, the processing order of a coding unit may be determined based on the process of dividing the coding unit. In other words, the processing order of the divided coding unit may be determined based on the processing order of the coding unit immediately before being divided. The image decoding apparatus 100 may determine the processing orders of the third coding units 720a and 720b determined by dividing the second left coding unit 710a independently of the second right coding unit 710b. Since the third coding units 720a and 720b are determined by dividing the second left coding unit 710a in the horizontal direction, the third coding units 720a and 720b may be processed in the vertical direction order 720c. Since the left coding unit 710a and the second right coding unit 710b are processed in the horizontal direction order 710c, the second right coding unit 710b may be processed after processing the third coding units 720a and 720b included in the second left coding unit 710a in the vertical direction order 720c. The process of determining the processing order of a coding unit based on the coding unit before being divided is not limited to the above example, and various methods may be used to independently process the divided coding units determined to be of various shapes in a specific order.
[0147] Figure 8 FIG. shows a process in which, according to an embodiment, when coding units cannot be processed in a specific order, the image decoding apparatus 100 determines that a current coding unit is to be divided into an odd number of coding units.
[0148] According to an embodiment, the image decoding apparatus 100 may determine that a current coding unit is to be divided into an odd number of coding units based on the obtained division shape mode information. Refer to Figure 8 , the square first coding unit 800 may be divided into non-square second coding units 810a and 810b, and the second coding units 810a and 810b may be independently divided into third coding units 820a and 820b and 820c, 820d, and 820e. According to an embodiment, the image decoding apparatus 100 may determine a plurality of third coding units 820a and 820b by dividing the second left coding unit 810a in the horizontal direction, and may divide the second right coding unit 810b into an odd number of third coding units 820c, 820d, and 820e.
[0149] According to an embodiment, the image decoding apparatus 100 may determine whether any coding unit is divided into an odd number of coding units by determining whether the third coding units 820a and 820b and 820c, 820d, and 820e can be processed in a specific order. Refer to Figure 8, the image decoding device 100 may determine the third coding units 820a, 820b, 820c, 820d, and 820e by recursively partitioning the first coding unit 800. The image decoding device 100 may determine whether any one of the first coding unit 800, the second coding units 810a and 810b, or the third coding units 820a, 820b, 820c, 820d, and 820e is partitioned into an odd number of coding units based on at least one of the block shape information and the partitioning shape mode information. For example, the right coding unit among the second coding units 810a and 810b may be partitioned into an odd number of third coding units 820c, 820d, and 820e. The processing order of the multiple coding units included in the first coding unit 800 may be a specific order (e.g., the Z-scan order 830), and the image decoding device 100 may determine whether the third coding units 820c, 820d, and 820e determined by partitioning the right second coding unit 810b into an odd number of coding units satisfy the condition for processing in a specific order.
[0150] According to an embodiment, the image decoding device 100 may determine whether the third coding units 820a, 820b, 820c, 820d, and 820e included in the first coding unit 800 satisfy the condition for processing in a specific order, and the condition relates to whether at least one of the width and height of the second coding units 810a and 810b will be divided into two halves along the boundaries of the third coding units 820a, 820b, 820c, 820d, and 820e. For example, the third coding units 820a and 820b determined when the height of the non-square-shaped left second coding unit 810a is divided into two halves may satisfy the condition. It may be determined that the third coding units 820c, 820d, and 820e do not satisfy the condition because the boundaries of the third coding units 820c, 820d, and 820e determined when the right second coding unit 810b is divided into three coding units cannot divide the width or height of the right second coding unit 810b into two halves. As described above, when the condition is not satisfied, the image decoding device 100 may determine a disconnection of the scan order and may determine based on the determined result that the right second coding unit 810b will be divided into an odd number of coding units. According to an embodiment, when a coding unit is divided into an odd number of coding units, the image decoding device 100 may impose a specific restriction on the coding unit at a specific position among the divided coding units. The restrictions or specific positions have been described above through various embodiments, so the detailed description thereof will be omitted.
[0151] Figure 9 The process of the image decoding device 100 according to an embodiment for determining at least one coding unit by partitioning the first coding unit 900 is shown.
[0152] According to an embodiment, the image decoding apparatus 100 may divide the first coding unit 900 based on the partitioning shape mode information obtained by the bitstream acquirer 110. The square first coding unit 900 may be divided into four square coding units, or may be divided into a plurality of non-square coding units. For example, referring to Figure 9 , when the first coding unit 900 has a square shape and the partitioning shape mode information indicates that the first coding unit 900 is to be divided into non-square coding units, the image decoding apparatus 100 may divide the first coding unit 900 into a plurality of non-square coding units. Specifically, when the partitioning shape mode information indicates that an odd number of coding units are to be determined by dividing the first coding unit 900 in the horizontal or vertical direction, the image decoding apparatus 100 may divide the square first coding unit 900 into an odd number of coding units, for example, the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in the vertical direction, or the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in the horizontal direction.
[0153] According to an embodiment, the image decoding apparatus 100 may determine whether the second coding units 910a, 910b, 910c, 920a, 920b, and 920c included in the first coding unit 900 satisfy a condition for being processed in a specific order, and the condition relates to whether at least one of the width and height of the first coding unit 900 will be divided in half along the boundaries of the second coding units 910a, 910b, 910c, 920a, 920b, and 920c. Referring to Figure 9, since the boundaries of the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in the vertical direction do not divide the width of the first coding unit 900 into two halves, it can be determined that the first coding unit 900 does not meet the condition for processing in a specific order. In addition, since the boundaries of the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in the horizontal direction do not divide the height of the first coding unit 900 into two halves, it can be determined that the first coding unit 900 does not meet the condition for processing in a specific order. As described above, when this condition is not met, the image decoding apparatus 100 may determine a break in the scanning order, and may determine that the first coding unit 900 is to be divided into an odd number of coding units based on the determined result. According to an embodiment, when a coding unit is divided into an odd number of coding units, the image decoding apparatus 100 may impose a specific restriction on the coding unit at a specific position among the divided coding units. The above-mentioned restriction or the specific position has been described through various embodiments, and thus a detailed description thereof will be omitted.
[0154] According to an embodiment, the image decoding apparatus 100 may determine coding units of various shapes by dividing a first coding unit.
[0155] Reference Figure 9 , the image decoding apparatus 100 may divide the square first coding unit 900 or the non-square first coding units 930 or 950 into coding units of various shapes.
[0156] Figure 10 It is shown that according to an embodiment, when a second coding unit having a non-square shape determined when the image decoding apparatus 100 divides a first coding unit 1000 meets a specific condition, the shape into which the second coding unit can be divided is restricted.
[0157] According to an embodiment, the image decoding apparatus 100 may determine to divide the square first coding unit 1000 into non-square second coding units 1010a and 1010b or 1020a and 1020b based on the partition shape mode information obtained by the bitstream acquirer 110. The second coding units 1010a and 1010b or 1020a and 1020b may be independently divided. Accordingly, the image decoding apparatus 100 may determine whether to divide each of the second coding units 1010a and 1010b or 1020a and 1020b into a plurality of coding units based on the partition shape mode information of each of the second coding units 1010a and 1010b or 1020a and 1020b. According to an embodiment, the image decoding apparatus 100 may determine third coding units 1012a and 1012b by dividing the non-square left second coding unit 1010a determined by dividing the first coding unit 1000 in the vertical direction in the horizontal direction. However, when the left second coding unit 1010a is divided in the horizontal direction, the image decoding apparatus 100 may restrict dividing the right second coding unit 1010b in the horizontal direction in which the left second coding unit 1010a is divided. When determining third coding units 1014a and 1014b by dividing the right second coding unit 1010b in the same direction, since the left second coding unit 1010a and the right second coding unit 1010b are independently divided in the horizontal direction, the third coding units 1012a, 1012b, 1014a, and 1014b may be determined. However, this case is equivalent to the case where the image decoding apparatus 100 divides the first coding unit 1000 into four square second coding units 1030a, 1030b, 1030c, and 1030d based on the partition shape mode information, and may be inefficient in terms of image decoding.
[0158] According to an embodiment, the image decoding apparatus 100 may determine third coding units 1022a and 1022b or 1024a and 1024b by dividing the non-square second coding unit 1020a or 1020b determined by dividing the first coding unit 1000 in the horizontal direction in the vertical direction. However, when the second coding unit (e.g., the upper second coding unit 1020a) is divided in the vertical direction, for the reasons described above, the image decoding apparatus 100 may restrict dividing another second coding unit (e.g., the lower second coding unit 1020b) in the vertical direction in which the upper second coding unit 1020a is divided.
[0159] Figure 11 Illustrated is a process in which the image decoding apparatus 100 divides a square coding unit according to an embodiment when the partition shape mode information indicates that the square coding unit is not divided into four square coding units.
[0160] According to an embodiment, the image decoding device 100 may determine second coding units 1110a and 1110b or 1120a and 1120b, etc. by dividing a first coding unit 1100 based on partition shape mode information. The partition shape mode information may include information on various methods of partitioning coding units. However, the information on various partitioning methods may not include information for partitioning a coding unit into four square coding units. According to such partition shape mode information, the image decoding device 100 may not divide the square first coding unit 1100 into four square second coding units 1130a, 1130b, 1130c, and 1130d. The image decoding device 100 may determine non-square second coding units 1110a and 1110b or 1120a and 1120b, etc. based on the partition shape mode information.
[0161] According to an embodiment, the image decoding device 100 may independently divide non-square second coding units 1110a and 1110b or 1120a and 1120b, etc. Each of the second coding units 1110a and 1110b or 1120a and 1120b, etc. may be recursively divided in a specific order, and such a partitioning method may correspond to the method of dividing the first coding unit 1100 based on the partition shape mode information.
[0162] For example, the image decoding device 100 may determine square third coding units 1112a and 1112b by dividing the left second coding unit 1110a in the horizontal direction, and may determine square third coding units 1114a and 1114b by dividing the right second coding unit 1110b in the horizontal direction. In addition, the image decoding device 100 may determine square third coding units 1116a, 1116b, 1116c, and 1116d by dividing both the left second coding unit 1110a and the right second coding unit 1110b in the horizontal direction. In this case, coding units having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 may be determined.
[0163] As another example, the image decoding apparatus 100 may determine square third coding units 1122a and 1122b by dividing an upper second coding unit 1120a in a vertical direction, and may determine square third coding units 1124a and 1124b by dividing a lower second coding unit 1120b in a vertical direction. In addition, the image decoding apparatus 100 may determine square third coding units 1126a, 1126b, 1126c, and 1126d by dividing both the upper second coding unit 1120a and the lower second coding unit 1120b in a vertical direction. In this case, coding units having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 may be determined.
[0164] Figure 12 It is shown that according to an embodiment, the processing order among a plurality of coding units may vary according to the process of dividing the coding units.
[0165] According to an embodiment, the image decoding apparatus 100 may divide a first coding unit 1200 based on division shape mode information. When the block shape indicates a square shape and the division shape mode information indicates dividing the first coding unit 1200 in at least one of a horizontal direction and a vertical direction, the image decoding apparatus 100 may determine second coding units (e.g., 1210a and 1210b or 1220a and 1220b, etc.) by dividing the first coding unit 1200. Referring to Figure 12 , non-square second coding units 1210a and 1210b or 1220a and 1220b determined by dividing the first coding unit 1200 only in a horizontal direction or a vertical direction may be independently divided based on the division shape mode information of each coding unit. For example, the image decoding apparatus 100 may determine third coding units 1216a, 1216b, 1216c, and 1216d by dividing the second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in a vertical direction in a horizontal direction, and may determine third coding units 1226a, 1226b, 1226c, and 1226d by dividing the second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in a horizontal direction in a vertical direction. The process of dividing the second coding units 1210a and 1210b or 1220a and 1220b has been described above with reference to Figure 11 , and thus a detailed description thereof will be omitted.
[0166] According to an embodiment, the image decoding apparatus 100 may process coding units in a specific order. It has been described above with reference to Figure 7The operation of processing coding units in a specific order is described, and thus a detailed description thereof will be omitted. Refer to Figure 12 , the image decoding apparatus 100 may determine four square third coding units 1216a, 1216b, 1216c, and 1216d, and 1226a, 1226b, 1226c, and 1226d by dividing a square first coding unit 1200. According to an embodiment, the image decoding apparatus 100 may determine the processing order of the third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d based on the division shape into which the first coding unit 1200 is divided.
[0167] According to an embodiment, the image decoding apparatus 100 may determine the third coding units 1216a, 1216b, 1216c, and 1216d by dividing second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in the vertical direction in the horizontal direction, and may process the third coding units 1216a, 1216b, 1216c, and 1216d in a processing order 1217 of first processing the third coding units 1216a and 1216c included in the left second coding unit 1210a in the vertical direction, and then processing the third coding units 1216b and 1216d included in the right second coding unit 1210b in the vertical direction.
[0168] According to an embodiment, the image decoding apparatus 100 may determine the third coding units 1226a, 1226b, 1226c, and 1226d by dividing second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in the horizontal direction in the vertical direction, and may process the third coding units 1226a, 1226b, 1226c, and 1226d in a processing order 1227 of first processing the third coding units 1226a and 1226b included in the upper second coding unit 1220a in the horizontal direction, and then processing the third coding units 1226c and 1226d included in the lower second coding unit 1220b in the horizontal direction.
[0169] Refer to Figure 12, the square third coding units 1216a, 1216b, 1216c, and 1216d, and 1226a, 1226b, 1226c, and 1226d can be respectively determined by dividing the second coding units 1210a and 1210b, and 1220a and 1220b. Although the second coding units 1210a and 1210b are determined by dividing the first coding unit 1200 in the vertical direction, different from the second coding units 1220a and 1220b determined by dividing the first coding unit 1200 in the horizontal direction, the third coding units 1216a, 1216b, 1216c, and 1216d, and 1226a, 1226b, 1226c, and 1226d divided therefrom ultimately show coding units of the same shape divided from the first coding unit 1200. Thus, by recursively dividing coding units in different ways based on the division shape pattern information, even when the coding units are finally determined to have the same shape, the image decoding device 100 can process multiple coding units in different orders.
[0170] Figure 13 Shows the process of determining the depth of coding units as the shape and size of the coding units change when the coding units are recursively divided to determine multiple coding units according to an embodiment.
[0171] According to an embodiment, the image decoding device 100 can determine the depth of coding units based on a specific criterion. For example, the specific criterion can be the length of the long side of the coding unit. When the length of the long side of the coding unit before division is 2n times (n > 0) the length of the long side of the currently divided coding unit, the image decoding device 100 can determine that the depth of the current coding unit is increased by n compared to the depth of the coding unit before division. In the following description, the coding unit with an increased depth is represented as a coding unit with a lower depth.
[0172] Reference Figure 13, according to an embodiment, the image decoding apparatus 100 may determine a second coding unit 1302 and a third coding unit 1304 of a lower depth by dividing a square first coding unit 1300 based on block shape information indicating a square shape (e.g., the block shape information may be expressed as '0:SQUARE'). Assuming that the size of the square first coding unit 1300 is 2Nx2N, the second coding unit 1302 determined by dividing the width and height of the first coding unit 1300 by 1 / 2 may have a size of NxN. In addition, the third coding unit 1304 determined by dividing the width and height of the second coding unit 1302 by 1 / 2 may have a size of N / 2xN / 2. In this case, the width and height of the third coding unit 1304 are 1 / 4 times that of the first coding unit 1300. When the depth of the first coding unit 1300 is D, the depth of the second coding unit 1302 whose width and height are 1 / 2 times that of the first coding unit 1300 may be D+1, and the depth of the third coding unit 1304 whose width and height are 1 / 4 times that of the first coding unit 1300 may be D+2.
[0173] According to an embodiment, the image decoding apparatus 100 may determine a second coding unit 1312 or 1322 and a third coding unit 1314 or 1324 of a lower depth by dividing a non-square first coding unit 1310 or 1320 based on block shape information indicating a non-square shape (e.g., the block shape information may be expressed as '1:NS_VER' indicating a non-square shape with a height longer than the width, or as '2:NS_HOR' indicating a non-square shape with a width longer than the height).
[0174] The image decoding apparatus 100 may determine the second coding units 1302, 1312, or 1322 by dividing at least one of the width and height of a first coding unit 1310 having a size of Nx2N. That is, the image decoding apparatus 100 may determine a second coding unit 1302 having a size of NxN or a second coding unit 1322 having a size of NxN / 2 by dividing the first coding unit 1310 in the horizontal direction, or may determine a second coding unit 1312 having a size of N / 2xN by dividing the first coding unit 1310 in both the horizontal and vertical directions.
[0175] According to an embodiment, the image decoding apparatus 100 may determine a second coding unit (e.g., 1302, 1312, or 1322) by dividing at least one of the width and height of a first coding unit 1320 having a size of 2NxN. That is, the image decoding apparatus 100 may determine a second coding unit 1302 having a size of NxN or a second coding unit 1312 having a size of N / 2xN by dividing the first coding unit 1320 in the vertical direction, or may determine a second coding unit 1322 having a size of NxN / 2 by dividing the first coding unit 1320 in both the horizontal and vertical directions.
[0176] According to an embodiment, the image decoding apparatus 100 may determine a third coding unit (e.g., 1304, 1314, or 1324) by dividing at least one of the width and height of a second coding unit 1302 having a size of NxN. That is, the image decoding apparatus 100 may determine a third coding unit 1304 having a size of N / 2xN / 2, a third coding unit 1314 having a size of N / 4xN / 2, or a third coding unit 1324 having a size of N / 2xN / 4 by dividing the second coding unit 1302 in both the vertical and horizontal directions.
[0177] According to an embodiment, the image decoding apparatus 100 may determine a third coding unit (e.g., 1304, 1314, or 1324) by dividing at least one of the width and height of a second coding unit 1312 having a size of N / 2xN. That is, the image decoding apparatus 100 may determine a third coding unit 1304 having a size of N / 2xN / 2 or a third coding unit 1324 having a size of N / 2xN / 4 by dividing the second coding unit 1312 in the horizontal direction, or may determine a third coding unit 1314 having a size of N / 4xN / 2 by dividing the second coding unit 1312 in both the vertical and horizontal directions.
[0178] According to an embodiment, the image decoding apparatus 100 may determine a third coding unit (e.g., 1304, 1314, or 1324) by dividing at least one of the width and height of a second coding unit 1322 having a size of NxN / 2. That is, the image decoding apparatus 100 may determine a third coding unit 1304 having a size of N / 2xN / 2 or a third coding unit 1314 having a size of N / 4xN / 2 by dividing the second coding unit 1322 in the vertical direction, or may determine a third coding unit 1324 having a size of N / 2xN / 4 by dividing the second coding unit 1322 in both the vertical and horizontal directions.
[0179] According to an embodiment, the image decoding apparatus 100 may divide a square coding unit (e.g., 1300, 1302, or 1304) in a horizontal direction or a vertical direction. For example, the image decoding apparatus 100 may determine a first coding unit 1310 having a size of Nx2N by dividing a first coding unit 1300 having a size of 2Nx2N in a vertical direction, or may determine a first coding unit 1320 having a size of 2NxN by dividing the first coding unit 1300 in a horizontal direction. According to an embodiment, when determining the depth based on the length of the longest side of the coding unit, the depth of the coding unit determined by dividing the first coding unit 1300 having a size of 2Nx2N in a horizontal direction or a vertical direction may be the same as the depth of the first coding unit 1300.
[0180] According to an embodiment, the width and height of the third coding unit 1314 or 1324 may be 1 / 4 times that of the first coding unit 1310 or 1320. When the depth of the first coding unit 1310 or 1320 is D, the depth of the second coding unit 1312 or 1322 having a width and height that are 1 / 2 times that of the first coding unit 1310 or 1320 may be D + 1, and the depth of the third coding unit 1314 or 1324 having a width and height that are 1 / 4 times that of the first coding unit 1310 or 1320 may be D + 2.
[0181] Figure 14 The depth that can be determined based on the shape and size of the coding unit, and the partial index (PID) for distinguishing the coding unit are shown according to an embodiment.
[0182] According to an embodiment, the image decoding apparatus 100 may determine second coding units of various shapes by dividing a square first coding unit 1400. Refer to Figure 14 , the image decoding apparatus 100 may determine second coding units 1402a and 1402b, 1404a and 1404b, and 1406a, 1406b, 1406c, and 1406d by dividing the first coding unit 1400 in at least one of a vertical direction and a horizontal direction based on division shape mode information. That is, the image decoding apparatus 100 may determine the second coding units 1402a and 1402b, 1404a and 1404b, and 1406a, 1406b, 1406c, and 1406d based on the division shape mode information of the first coding unit 1400.
[0183] According to an embodiment, the depths of second coding units 1402a and 1402b, 1404a and 1404b, and 1406a, 1406b, 1406c, and 1406d determined based on the division shape pattern information of the square first coding unit 1400 may be determined based on the length of their long sides. For example, since the length of the side of the square first coding unit 1400 is equal to the length of the long sides of the non-square second coding units 1402a and 1402b and 1404a and 1404b, the first coding unit 1400 and the non-square second coding units 1402a and 1402b and 1404a and 1404b may have the same depth, such as D. However, when the image decoding apparatus 100 divides the first coding unit 1400 into four square second coding units 1406a, 1406b, 1406c, and 1406d based on the division shape pattern information, since the length of the side of the square second coding units 1406a, 1406b, 1406c, and 1406d is 1 / 2 times the length of the side of the first coding unit 1400, the depth of the second coding units 1406a, 1406b, 1406c, and 1406d may be D + 1, which is 1 deeper than the depth D of the first coding unit 1400.
[0184] According to an embodiment, the image decoding apparatus 100 may determine a plurality of second coding units 1412a and 1412b and 1414a, 1414b, and 1414c by dividing a first coding unit 1410 having a height longer than a width in a horizontal direction based on the division shape pattern information. According to an embodiment, the image decoding apparatus 100 may determine a plurality of second coding units 1422a and 1422b and 1424a, 1424b, and 1424c by dividing a first coding unit 1420 having a width longer than a height in a vertical direction based on the division shape pattern information.
[0185] According to an embodiment, the depths of second coding units 1412a and 1412b and 1414a, 1414b, and 1414c or 1422a and 1422b and 1424a, 1424b, and 1424c determined based on the division shape pattern information of the non-square first coding unit 1410 or 1420 may be determined based on the length of their long sides. For example, since the length of the side of the square second coding units 1412a and 1412b is 1 / 2 times the length of the long side of the non-square shaped first coding unit 1410 having a height longer than a width, the depth of the square second coding units 1412a and 1412b is D + 1, which is 1 deeper than the depth D of the non-square first coding unit 1410.
[0186] In addition, the image decoding apparatus 100 may divide the non-square first coding unit 1410 into an odd number of second coding units 1414a, 1414b, and 1414c based on the partitioning shape mode information. The odd number of second coding units 1414a, 1414b, and 1414c may include non-square second coding units 1414a and 1414c and a square second coding unit 1414b. In this case, since the length of the long side of the non-square second coding units 1414a and 1414c and the length of the side of the square second coding unit 1414b are 1 / 2 times the length of the long side of the first coding unit 1410, the depth of the second coding units 1414a, 1414b, and 1414c may be D + 1, which is 1 deeper than the depth D of the non-square first coding unit 1410. The image decoding apparatus 100 may determine the depth of the coding units divided from the first coding unit 1420 having a non-square shape with a width longer than the height by using the above method for determining the depth of the coding units divided from the first coding unit 1410.
[0187] According to an embodiment, when the odd number of divided coding units do not have the same size, the image decoding apparatus 100 may determine the PID for identifying the divided coding units based on the size ratio between the coding units. Refer to Figure 14 , among the odd number of divided coding units 1414a, 1414b, and 1414c, the coding unit 1414b at the center position may have a width equal to the width of the other coding units 1414a and 1414c and a height twice the height of the other coding units 1414a and 1414c. That is, in this case, the coding unit 1414b at the center position may include two of the other coding units 1414a or 1414c. Therefore, when the PID of the coding unit 1414b at the center position is 1 based on the scanning order, the PID of the coding unit 1414c adjacent to the coding unit 1414b may be increased by 2 and thus may be 3. That is, the PID values may not be continuous. According to an embodiment, the image decoding apparatus 100 may determine whether the odd number of divided coding units have the same size based on whether the PID for identifying the divided coding units is discontinuous.
[0188] According to an embodiment, the image decoding apparatus 100 may determine whether to use a specific partitioning method based on the PID values of the plurality of coding units determined by partitioning the current coding unit. Refer to Figure 14, the image decoding apparatus 100 may determine an even number of coding units 1412a and 1412b or an odd number of coding units 1414a, 1414b, and 1414c by dividing a first coding unit 1410 having a rectangular shape with a height longer than a width. The image decoding apparatus 100 may identify each coding unit by using a PID indicating each coding unit. According to an embodiment, a PID may be obtained from samples (e.g., top-left samples) at a specific position of each coding unit.
[0189] According to an embodiment, the image decoding apparatus 100 may determine a coding unit at a specific position from among the divided coding units by using a PID for distinguishing coding units. According to an embodiment, when the division shape pattern information of the first coding unit 1410 having a rectangular shape with a height longer than a width indicates that the coding unit is divided into three coding units, the image decoding apparatus 100 may divide the first coding unit 1410 into three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 may assign a PID to each of the three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 may compare the PIDs of the odd number of divided coding units to determine a coding unit at a central position from among the coding units. The image decoding apparatus 100 may determine the coding unit 1414b having a PID corresponding to the median value among the PIDs of the coding units as the coding unit at the central position among the coding units determined by dividing the first coding unit 1410. According to an embodiment, when the divided coding units do not have the same size, the image decoding apparatus 100 may determine a PID for distinguishing the divided coding units based on the size ratio between the coding units. Refer to Figure 14, the coding unit 1414b generated by dividing the first coding unit 1410 may have a width equal to the widths of the other coding units 1414a and 1414c and a height that is twice the height of the other coding units 1414a and 1414c. In this case, when the PID of the coding unit 1414b at the center position is 1, the PID of the coding unit 1414c located next to the coding unit 1414b may be increased by 2 and thus may be 3. As described above, when the PID does not increase uniformly, the image decoding apparatus 100 may determine that the coding unit is divided into a plurality of coding units including a coding unit having a size different from that of the other coding units. According to an embodiment, when the division shape mode information indicates that the coding unit is divided into an odd number of coding units, the image decoding apparatus 100 may divide the current coding unit in such a manner that a coding unit at a specific position (e.g., the coding unit at the center position) among the odd number of coding units has a size different from that of the other coding units. In this case, the image decoding apparatus 100 may determine the coding unit at the center position having a different size by using the PID of the coding unit. However, the PID and the size or position of the coding unit at the specific position to be determined are not limited to the above examples, and coding units having various PIDs and various positions and sizes may be used.
[0190] According to an embodiment, the image decoding apparatus 100 may use a specific data unit in which the coding unit starts to be recursively divided.
[0191] Figure 15 An example is shown of determining a plurality of coding units based on a plurality of specific data units included in a picture according to an embodiment.
[0192] According to an embodiment, the specific data unit may be defined as a data unit in which the coding unit starts to be recursively divided by using the division shape mode information. That is, the specific data unit may correspond to a coding unit having the maximum depth and is used to determine a plurality of coding units divided from the current picture. In the following description, for convenience of explanation, the specific data unit is referred to as a reference data unit.
[0193] According to an embodiment, the reference data unit may have a specific size and a specific shape. According to an embodiment, the reference coding unit may include MxN samples. Here, M and N may be equal to each other and may be an integer represented as a power of 2. That is, the reference data unit may have a square shape or a non-square shape and may be divided into an integer number of coding units.
[0194] According to an embodiment, the image decoding apparatus 100 may divide a current picture into a plurality of reference data units. According to an embodiment, the image decoding apparatus 100 may divide the plurality of reference data units divided from the current picture by using the division shape mode information of each reference data unit. The process of dividing the reference data units may correspond to a division process using a quadtree structure.
[0195] According to an embodiment, the image decoding apparatus 100 may pre-determine the minimum size of the reference data units allowed to be included in the current picture. Thus, the image decoding apparatus 100 may determine reference data units having various sizes equal to or greater than the minimum size, and may determine one or more coding units by referring to the determined reference data units and using the division shape mode information.
[0196] Reference Figure 15 , the image decoding apparatus 100 may use a square reference coding unit 1500 or a non-square reference coding unit 1502. According to an embodiment, the shape and size of the reference coding unit may be determined based on various data units capable of including one or more reference coding units (e.g., sequence, picture, slice, slice segment, block, block group, maximum coding unit, etc.).
[0197] According to an embodiment, the bitstream acquirer 110 of the image decoding apparatus 100 may acquire at least one of the reference coding unit shape information and the reference coding unit size information of each of the various data units from the bitstream. The process of dividing the square reference coding unit 1500 into one or more coding units has been described above in connection with Figure 3 the process of dividing the current coding unit 300, and the process of dividing the non-square reference coding unit 1502 into one or more coding units has been described above in connection with Figure 4 the process of dividing the current coding unit 400 or 450, and thus the detailed description thereof will be omitted.
[0198] According to an embodiment, the image decoding apparatus 100 may use a PID for identifying the size and shape of a reference coding unit to determine the size and shape of the reference coding unit according to some data units predetermined based on specific conditions. That is, the bitstream acquirer 110 may obtain from the bitstream only the PID for identifying the size and shape of the reference coding unit regarding each slice, segment, block, block group, or the largest coding unit as a data unit that satisfies specific conditions (e.g., a data unit having a size equal to or smaller than a slice) among various data units (e.g., sequence, picture, slice, segment, block, block group, largest coding unit, etc.). The image decoding apparatus 100 may determine the size and shape of the reference data unit for each data unit that satisfies specific conditions by using the PID. When the reference coding unit shape information and the reference coding unit size information are obtained from and used in the bitstream according to each data unit having a relatively small size, the efficiency of using the bitstream may not be high. Thus, instead of directly obtaining the reference coding unit shape information and the reference coding unit size information, only the PID may be obtained and used. In this case, at least one of the size and shape of the reference coding unit corresponding to the PID for identifying the size and shape of the reference coding unit may be predetermined. That is, the image decoding apparatus 100 may determine at least one of the size and shape of the reference coding unit included in the data unit used as the unit for obtaining the PID by selecting at least one of the predetermined size and shape of the reference coding unit based on the PID.
[0199] According to an embodiment, the image decoding apparatus 100 may use one or more reference coding units included in the largest coding unit. That is, the largest coding unit divided from a picture may include one or more reference coding units, and the coding unit may be determined by recursively dividing each reference coding unit. According to an embodiment, at least one of the width and height of the largest coding unit may be an integer multiple of at least one of the width and height of the reference coding unit. According to an embodiment, the size of the reference coding unit may be obtained by dividing the largest coding unit n times based on a quadtree structure. That is, according to various embodiments, the image decoding apparatus 100 may determine the reference coding unit by dividing the largest coding unit n times based on a quadtree structure, and may divide the reference coding unit based on at least one of block shape information and division shape mode information.
[0200] According to an embodiment, the image decoding apparatus 100 may obtain block shape information indicating the shape of a current coding unit or partitioning shape mode information indicating a partitioning method of the current coding unit from a bitstream, and may use the obtained information. The partitioning shape mode information may be included in the bitstream related to various data units. For example, the image decoding apparatus 100 may use the partitioning shape mode information included in a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a segment header, a block header, or a block group header. In addition, the image decoding apparatus 100 may obtain a syntax element corresponding to the block shape information or the partitioning shape mode information from the bitstream according to each maximum coding unit or each reference coding unit, and may use the obtained syntax element.
[0201] Hereinafter, a method for determining a partitioning rule according to an embodiment of the present disclosure will be described in detail.
[0202] The image decoding apparatus 100 may determine a partitioning rule of an image. The partitioning rule may be determined in advance between the image decoding apparatus 100 and the image encoding apparatus 200. The image decoding apparatus 100 may determine the partitioning rule of the image based on the information obtained from the bitstream. The image decoding apparatus 100 may determine the partitioning rule based on the information obtained from at least one of a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a segment header, a block header, and a block group header. The image decoding apparatus 100 may determine the partitioning rule differently according to a frame, a slice, a block, a temporal layer, a maximum coding unit, or a coding unit.
[0203] The image decoding apparatus 100 may determine the partitioning rule based on the block shape of the coding unit. The block shape may include the size, shape, aspect ratio, and direction of the coding unit. The image encoding apparatus 200 and the image decoding apparatus 100 may determine the partitioning rule based on the block shape of the coding unit in advance. However, the embodiment is not limited thereto. The image decoding apparatus 100 may determine the partitioning rule based on the information obtained from the bitstream received from the image encoding apparatus 200.
[0204] The shape of the coding unit may include a square and a non-square. When the lengths of the width and height of the coding unit are the same, the image decoding apparatus 100 may determine the shape of the coding unit as a square. In addition, when the lengths of the width and height of the coding unit are different, the image decoding apparatus 100 may determine the shape of the coding unit as a non-square.
[0205] The size of the coding unit may include various sizes, such as 4x4, 8x4, 4x8, 8x8, 16x4, 16x8, ……, and 256x256. The size of the coding unit may be classified based on the length of the long side, the length of the short side, or the area of the coding unit. The image decoding device 100 may apply the same partitioning rule to the coding units classified into the same group. For example, the image decoding device 100 may classify the coding units with the same long side length as having the same size. In addition, the image decoding device 100 may apply the same partitioning rule to the coding units with the same long side length.
[0206] The aspect ratio of the coding unit may include 1∶2, 2∶1, 1∶4, 4∶1, 1∶8, 8∶1, 1∶16, 16∶1, 32∶1, 1∶32, etc. In addition, the direction of the coding unit may include a horizontal direction and a vertical direction. The horizontal direction may indicate a case where the length of the width of the coding unit is longer than the length of its height. The vertical direction may indicate a case where the length of the width of the coding unit is shorter than the length of its height.
[0207] The image decoding device 100 may adaptively determine the partitioning rule based on the size of the coding unit. The image decoding device 100 may differently determine the allowed partitioning shape modes based on the size of the coding unit. For example, the image decoding device 100 may determine whether partitioning is allowed based on the size of the coding unit. The image decoding device 100 may determine the partitioning direction according to the size of the coding unit. The image decoding device 100 may determine the allowed partitioning type according to the size of the coding unit.
[0208] The partitioning rule determined based on the size of the coding unit may be a partitioning rule predetermined between the image encoding device 200 and the image decoding device 100. In addition, the image decoding device 100 may determine the partitioning rule based on the information obtained from the bitstream.
[0209] The image decoding device 100 may adaptively determine the partitioning rule based on the position of the coding unit. The image decoding device 100 may adaptively determine the partitioning rule based on the position of the coding unit in the image.
[0210] In addition, the image decoding device 100 may determine the partitioning rule such that the coding units generated via different partitioning paths do not have the same block shape. However, the embodiment is not limited thereto, and the coding units generated via different partitioning paths have the same block shape. The coding units generated via different partitioning paths may have different decoding processing orders. Since the decoding processing order has been described above with reference to Figure 12 it, a detailed description thereof will be omitted.
[0211] Figure 16Shows the coding units that can be determined for each picture when the combination of shapes into which a coding unit can be divided is different for each picture according to an embodiment.
[0212] Reference Figure 16 , the image decoding apparatus 100 may differently determine the combination of partitioning shapes into which a coding unit can be divided for each picture. For example, the image decoding apparatus 100 may decode an image by using Picture 1600 that can be divided into four coding units, Picture 1610 that can be divided into two or four coding units, and Picture 1620 that can be divided into two, three, or four coding units among one or more pictures included in the image. To divide Picture 1600 into a plurality of coding units, the image decoding apparatus 100 may use only the partitioning shape information indicating division into four square coding units. To divide Picture 1610, the image decoding apparatus 100 may use only the partitioning shape information indicating division into two or four coding units. To divide Picture 1620, the image decoding apparatus 100 may use only the partitioning shape information indicating division into two, three, or four coding units. The above combinations of partitioning shapes are merely examples for describing the operation of the image decoding apparatus 100. Therefore, the above combinations of partitioning shapes should not be construed as being limited to the above embodiments, but rather that various types of combinations of partitioning shapes can be used for a specific data unit.
[0213] According to an embodiment, the bitstream acquirer 110 of the image decoding apparatus 100 may acquire a bitstream including an index of a combination of partitioning shape information indicating each specific data unit (e.g., sequence, picture, slice, segment, block, or group of blocks). For example, the bitstream acquirer 110 may acquire an index of a combination of partitioning shape information from a sequence parameter set, a picture parameter set, a slice header, a block header, or a group of block headers. The bitstream acquirer 110 of the image decoding apparatus 100 may determine, for each specific data unit, the combination of partitioning shapes into which a coding unit can be divided by using the acquired index, and thus, different combinations of partitioning shapes can be used for each specific data unit.
[0214] Figure 17 Shows various shapes of coding units that can be determined based on partitioning shape pattern information that can be represented as a binary code according to an embodiment.
[0215] According to an embodiment, the image decoding apparatus 100 may divide a coding unit into various shapes by using the block shape information and the partitioning shape pattern information acquired by the bitstream acquirer 110. The shapes into which a coding unit can be divided may be various shapes, including the shapes described above by way of embodiments.
[0216] Reference Figure 17, the image decoding apparatus 100 may divide a coding unit having a square shape in at least one of a horizontal direction and a vertical direction based on the partition shape mode information, and divide a coding unit having a non-square shape in the horizontal direction or the vertical direction.
[0217] According to an embodiment, when the image decoding apparatus 100 can divide a coding unit having a square shape in the horizontal direction and the vertical direction to determine four square coding units, the partition shape mode information of the square coding unit may represent four partition shapes. According to an embodiment, the partition shape mode information may be represented as a two-bit binary code and the binary code may be assigned to each partition shape. For example, when the coding unit is not divided, the partition shape mode information may be represented as (00)b, when the coding unit is divided in the horizontal direction and the vertical direction, the partition shape mode information may be represented as (01)b, when the coding unit is divided in the horizontal direction, the partition shape mode information may be represented as (10)b, and when the coding unit is divided in the vertical direction, the partition shape mode information may be represented as (11)b.
[0218] According to an embodiment, when the image decoding apparatus 100 divides a coding unit having a non-square shape in the horizontal direction or the vertical direction, the type of the partition shape that can be represented by the partition shape mode information may depend on the number of coding units into which the coding unit is to be divided. Refer to Figure 17 , according to an embodiment, the image decoding apparatus 100 may divide a coding unit having a non-square shape into at most three coding units. In addition, the image decoding apparatus 100 may divide the coding unit into two coding units. In this case, the partition shape mode information may be represented as (10)b. The image decoding apparatus 100 may divide the coding unit into three coding units. In this case, the partition shape mode information may be represented as (11)b. The image decoding apparatus 100 may determine not to divide the coding unit. In this case, the partition shape mode information may be represented as (0)b. That is, the image decoding apparatus 100 may use variable length coding (VLC), instead of fixed length coding (FLC), in order to use the binary code representing the partition shape mode information.
[0219] According to an embodiment, refer to Figure 17 , the binary code of the partition shape mode information indicating that the coding unit is not divided may be represented as (0)b. When the binary code of the partition shape mode information indicating that the coding unit is not divided is set to (00)b, although no partition shape mode information is set to (01)b, the binary code of the 2-bit partition shape mode information should be all used. However, as Figure 17As shown, when three partitioning shapes are used for a coding unit having a non-square shape, the image decoding apparatus 100 may determine that the coding unit is not partitioned by using a 1-bit binary code (0)b as the partitioning shape mode information, thereby efficiently using the bitstream. However, the partitioning shape of the coding unit having a non-square shape represented by the partitioning shape mode information should not be construed as being limited to Figure 17 the three shapes shown, but should be construed as including the various shapes of the above embodiments.
[0220] Figure 18 FIG. shows other shapes of the coding unit that can be determined based on the partitioning shape mode information that can be represented as a binary code according to an embodiment.
[0221] Referring to Figure 18 , based on the partitioning shape mode information, the image decoding apparatus 100 may partition a square coding unit in the horizontal or vertical direction and may partition a non-square coding unit in the horizontal or vertical direction. That is, the partitioning shape mode information may indicate partitioning a square coding unit in one direction. In this case, the binary code of the partitioning shape mode information indicating not partitioning the square coding unit may be represented as (0)b. When the binary code of the partitioning shape mode information indicating not partitioning the coding unit is configured as (00)b, all 2-bit binary codes of the partitioning shape mode information may have to be used even without the partitioning shape mode information configured as (01)b. However, as Figure 18 shown, when three partitioning shapes for a square coding unit are used, the image decoding apparatus 100 can determine not to partition the coding unit even by using a 1-bit binary code (0)b as the partitioning shape mode information. Therefore, the bitstream can be efficiently used. However, the partitioning shape of the square coding unit indicated by the partitioning shape mode information should not be construed as being limited to Figure 18 the three partitioning shapes shown, but should be construed as including the various shapes of the above embodiments.
[0222] According to an embodiment, the block shape information or the partitioning shape mode information may be represented by using a binary code, and the block shape information or the partitioning shape mode information may be directly generated as a bitstream. In addition, the block shape information or the partitioning shape mode information that can be represented as a binary code may not be directly generated as a bitstream, but may be used as a binary code input in context adaptive binary arithmetic coding (CABAC).
[0223] According to an embodiment, a process in which an image decoding apparatus 100 obtains a syntax of block shape information or partition shape mode information through CABAC is described. A bitstream acquirer 110 may acquire a bitstream including binary codes regarding the syntax. The image decoding apparatus 100 may detect a syntax element indicating the block shape information or the partition shape mode information by performing inverse binarization on a bin string included in the acquired bitstream. According to an embodiment, the image decoding apparatus 100 may obtain a set of binary bin strings corresponding to a syntax element to be decoded, and may decode each bin by using probability information. In addition, the image decoding apparatus 100 may repeat the process until a bin string composed of the decoded bins becomes the same as one of the previously acquired bin strings. The image decoding apparatus 100 may determine the syntax element by performing inverse binarization on the bin string.
[0224] According to an embodiment, the image decoding apparatus 100 may determine the syntax of a bin string by performing decoding processing of adaptive binary arithmetic coding, and the image decoding apparatus 100 may update a probability model regarding the bins acquired by the bitstream acquirer 110. Refer to Figure 17 , according to an embodiment, the bitstream acquirer 110 of the image decoding apparatus 100 may acquire a bitstream indicating a binary code representing partition shape mode information. The image decoding apparatus 100 may determine the syntax of the partition shape mode information by using the acquired 1-bit or 2-bit sized binary code. To determine the syntax of the partition shape mode information, the image decoding apparatus 100 may update the probability of each bit of the 2-bit binary code. That is, according to whether the value of the first bin of the 2-bit binary code is 0 or 1, the image decoding apparatus 100 may update the probability that the next bin will have a value of 0 or 1 when the next bin is decoded.
[0225] According to an embodiment, during the process of determining the syntax, the image decoding apparatus 100 may update the probability regarding a bin during the process of decoding the bin of the bin string regarding the syntax, and for a specific bit among the bin strings, the image decoding apparatus 100 may not update the probability and may determine that the probabilities are the same.
[0226] Refer to Figure 17, in the process of determining the syntax by using a bin string representing partition shape mode information regarding a non-square coding unit, when the non-square coding unit is not partitioned, the image decoding apparatus 100 may determine the syntax of the partition shape mode information by using one bin having a value of 0. That is, when the block shape information indicates that the current coding unit has a non-square shape, when the non-square coding unit is not partitioned, the first bin of the bin string regarding the partition shape mode information may be 0, and when the non-square coding unit is partitioned into two or three coding units, the first bin may be 1. Accordingly, the probability that the first bin of the bin string regarding the partition shape mode information of the non-square coding unit is 0 may be 1 / 3, and the probability that the first bin of the bin string regarding the partition shape mode information of the non-square coding unit is 1 may be 2 / 3. As described above, since the partition shape mode information indicating that the non-square coding unit is not partitioned may be represented by using only a 1-bit bin string having a value of 0, the image decoding apparatus 100 may determine the syntax of the partition shape mode information by determining whether the second bin is 0 or 1 only when the first bin of the partition shape mode information is 1. According to an embodiment, when the first bin regarding the partition shape mode information is 1, the image decoding apparatus 100 may consider that the probability that the second bin is 0 and the probability that the second bin is 1 are the same, and may decode the bin.
[0227] According to an embodiment, in the process of determining the bin of the bin string regarding the partition shape mode information, the image decoding apparatus 100 may use various probabilities for each bin. According to an embodiment, the image decoding apparatus 100 may differently determine the probability of the bin regarding the partition shape mode information according to the direction of the non-square block. According to an embodiment, the image decoding apparatus 100 may differently determine the probability of the bin regarding the partition shape mode information according to the area or the length of the long side of the current coding unit. According to an embodiment, the image decoding apparatus 100 may differently determine the probability of the bin regarding the partition shape mode information according to at least one of the shape and the length of the long side of the current coding unit.
[0228] According to an embodiment, the image decoding apparatus 100 may determine that the probabilities of the bins regarding the partition shape mode information are the same for coding units having a size equal to or greater than a specific size. For example, the image decoding apparatus 100 may determine, based on the length of the long side of the coding unit, that the probabilities of the bins regarding the partition shape mode information are the same for coding units having a size equal to or greater than 64 samples.
[0229] According to an embodiment, the image decoding apparatus 100 may determine the initial probability of the bin constituting the bin string of the partition shape mode information based on the slice type (e.g., I slice, P slice, or B slice).
[0230] Figure 19 It is a block diagram of an image encoding and decoding system that performs loop filtering.
[0231] The encoding end 1910 of the image encoding and decoding system 1900 transmits an encoded bitstream of an image, and the decoding end 1950 outputs a reconstructed image by receiving and decoding the bitstream. Here, the encoding end 1910 may have a configuration similar to that of the image encoding device 200 to be described below, and the decoding end 1950 may have a configuration similar to that of the image decoding device 100.
[0232] At the encoding end 1910, the prediction encoder 1915 outputs prediction data via inter-frame prediction and intra-frame prediction, and the transformer and quantizer 1920 output quantized transform coefficients of the residual data between the prediction data and the current input image. The entropy encoder 1925 encodes and transforms the quantized transform coefficients and outputs the quantized transform coefficients as a bitstream. The quantized transform coefficients are reconstructed into data in the spatial domain via the inverse quantizer and inverse transformer 1930, and the reconstructed data in the spatial domain is output as a reconstructed image via the deblocking filter 1935 and the loop filter 1940. The reconstructed image can be used as a reference image for the next input image via the prediction encoder 1915.
[0233] Among the bitstream received by the decoding end 1950, the encoded image data is reconstructed into residual data in the spatial domain via the entropy decoder 1955 and the inverse quantizer and inverse transformer 1960. The prediction data and the residual data output from the prediction decoder 1975 can be combined to construct image data in the spatial domain, and the deblocking filter 1965 and the loop filter 1970 can perform filtering on the image data in the spatial domain to output a reconstructed image of the current original image. The reconstructed image can be used as a reference image for the next original image via the prediction decoder 1975.
[0234] The loop filter 1940 at the encoding end 1910 performs loop filtering by using filter information input according to user input or system settings. The filter information used by the loop filter 1940 is output to the entropy encoder 1925 and is sent to the decoding end 1950 together with the encoded image data. The loop filter 1970 at the decoding end 1950 can perform loop filtering based on the filter information input to the decoding end 1950.
[0235] The above various embodiments describe operations related to the image decoding method performed by the image decoding device 100. Hereinafter, the operations of the image encoding device 200 for performing the image encoding method will be described through various embodiments, which correspond to the reverse process of the image decoding method.
[0236] Figure 2It is a block diagram of an image encoding apparatus 200 capable of encoding an image based on at least one of block shape information and division shape pattern information according to an embodiment.
[0237] The image encoding apparatus 200 may include an encoder 220 and a bitstream generator 210. The encoder 220 may receive an input image and encode the input image. The encoder 220 may obtain at least one syntax element by encoding the input image. 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 transformed and quantized coefficient, an encoded block pattern, an encoded block flag, an intra prediction mode, a direct flag, a merge flag, an incremental QP, a reference index, a prediction direction, and a transform index. The encoder 220 may determine a context model based on block shape information including at least one of the shape, direction, aspect ratio, and size of an encoding unit.
[0238] The bitstream generator 210 may generate a bitstream based on the encoded input image. For example, the bitstream generator 210 may generate a bitstream by performing entropy encoding on the syntax element based on the context model. In addition, the image encoding apparatus 200 may send the bitstream to the image decoding apparatus 100.
[0239] According to an embodiment, the encoder 220 of the image encoding apparatus 200 may determine the shape of an encoding unit. For example, the encoding unit may have a square shape or a non-square shape, and information indicating the square shape or the non-square shape may be included in the block shape information.
[0240] According to an embodiment, the encoder 220 may determine the shape into which an encoding unit is to be divided. The encoder 220 may determine the shape of at least one encoding unit included in the encoding unit, and the bitstream generator 210 may generate a bitstream including division shape pattern information including information about the shape of the encoding unit.
[0241] According to an embodiment, the encoder 220 may determine whether to divide an encoding unit. When the encoder 220 determines that only one encoding unit is included in the encoding unit or the encoding unit is not divided, the bitstream generator 210 may generate a bitstream including division shape pattern information indicating that the encoding unit is not divided. In addition, the encoder 220 may divide the encoding unit into a plurality of encoding units, and the bitstream generator 210 may generate a bitstream including division shape pattern information indicating that the encoding unit is divided into a plurality of encoding units.
[0242] According to an embodiment, information indicating the number of coding units into which a coding unit is to be divided or the direction in which the coding unit is to be divided may be included in the partitioning shape mode information. For example, the partitioning shape mode information may indicate dividing the coding unit in at least one of the vertical direction and the horizontal direction, or may indicate whether to divide the coding unit.
[0243] The image encoding device 200 may determine information about the partitioning shape mode based on the partitioning shape mode of the coding unit. The image encoding device 200 may determine a context model based on at least one of the shape, direction, aspect ratio, and size of the coding unit. In addition, the image encoding device 200 may generate information about the partitioning shape mode for partitioning the coding unit as a bitstream based on the context model.
[0244] To determine the context model, the image encoding device 200 may obtain an arrangement for establishing a correspondence between at least one of the shape, direction, aspect ratio, and size of the coding unit and an index of the context model. The image encoding device 200 may obtain the index of the context model from the arrangement based on at least one of the shape, direction, aspect ratio, and size of the coding unit. The image encoding device 200 may determine the context model based on the index of the context model.
[0245] To determine the context model, the image encoding device 200 may also determine the context model based on block shape information including at least one of the shape, direction, aspect ratio, and size of adjacent coding units adjacent to the coding unit. In addition, the adjacent coding units may include at least one of the coding units located at the lower left, left, upper left, upper, upper right, right, and lower right of the coding unit.
[0246] In addition, the image encoding device 200 may compare the width of the upper adjacent coding unit with the width of the coding unit to determine the context model. In addition, the image encoding device 200 may compare the height of the left and right adjacent coding units with the height of the coding unit. In addition, the image encoding device 200 may determine the context model based on the result of the comparison.
[0247] The operations of the image encoding device 200 include aspects similar to those of the image decoding device 100 described with reference to Figures 3 to 19 Therefore, detailed description thereof will be omitted.
[0248] Figure 20 is a block diagram showing the configuration of an image decoding device 2000 according to an embodiment.
[0249] Referring to Figure 20 the image decoding device 2000 may include an acquirer 2010 and a prediction decoder 2030. Figure 20The acquirer 2010 shown may correspond to Figure 1 the bitstream acquirer 110 shown, and the prediction decoder 2030 may correspond to Figure 1 the decoder 120 shown.
[0250] In addition, the acquirer 2010 and the prediction decoder 2030 according to an embodiment may be implemented as at least one processor. The image decoding apparatus 2000 may include one or more memories (not shown) that store the input / output data of the acquirer 2010 and the prediction decoder 2030. In addition, the image decoding apparatus 2000 may include a memory controller (not shown) that controls the data input / output of the memory (not shown).
[0251] The acquirer 2010 receives a bitstream generated as a result of encoding an image. The acquirer 2010 obtains syntax elements for decoding the image from the bitstream. According to the hierarchical structure of the image, binary values corresponding to the syntax elements may be included in the bitstream. The acquirer 2010 may obtain the syntax elements by performing entropy decoding on the binary values included in the bitstream.
[0252] The bitstream may include size information of the image to be decoded, information indicating a prediction mode of blocks included in the image, information indicating motion vectors of inter-frame predicted blocks, and information indicating residual data between predicted samples and original samples.
[0253] In an embodiment, the image to be decoded may have various sizes. The size may refer to the area of the image. Alternatively, the size may refer to the width and / or height of the image. In another example, the size may refer to the ratio between any one of the width and height of the image and the other of the width and height of the image.
[0254] For adaptive streaming services, the image may need to have various sizes. In real-time video communication, since images of various sizes are supported without inserting I pictures, the channel state can be adaptively responded to and user preferences can be reflected. In addition, the quality degradation of the reconstructed image caused by I pictures can be reduced. However, in the case of inter-frame prediction using temporal redundancy between images, the computational amount of generating predicted samples may increase due to the various sizes of the images, and the reliability of the predicted samples may be reduced. Therefore, an image decoding method that takes into account the image size is needed.
[0255] Figure 21 is a diagram showing an image sequence having various sizes.
[0256] When the width of the current image 2100 is w1 and the height of the current image 2100 is h1, the sizes of the first to third images 2110, 2120, and 2130 decoded earlier than the current image 2100 may be the same as, larger than, or smaller than the size of the current image 2100.
[0257] As Figure 21 shown, the width and height of the first image 2110 are w2 and h2 respectively. h2 and w2 may be larger than h1 and w1. That is, the size of the first image 2110 is larger than the size of the current image 2100. In addition, the width and height of the second image 2120 are w3 and h3. h3 and w3 may be smaller than h1 and w1. That is, the size of the second image 2120 is smaller than the size of the current image 2100.
[0258] In an embodiment, when an image is larger than the current image 2100, it may mean that the area of the image is larger than the area of the current image 2100. Conversely, when an image is smaller than the current image 2100, it may mean that the area of the image is smaller than the area of the current image 2100.
[0259] Although not shown in Figure 21 it, the size of an image decoded earlier than the current image 2100 may be the same as the size of the current image 2100.
[0260] In an embodiment, the size comparison between images may be performed based on each of the width and height. For example, the width and height of the third image 2130 are w2 and h3 respectively. w2 may be larger than w1, while h3 may be smaller than h1. The width of the third image 2130 is larger than the width of the current image 2100, and the height of the third image 2130 is smaller than the height of the current image 2100.
[0261] When the sizes of the current image 2100 and a previously decoded image are compared with each other for inter-frame prediction, the size comparison may be performed based on each of the width and height. That is, the width and height of the first image 2110 are larger than the width and height of the current image 2100, the width and height of the second image 2120 are smaller than the width and height of the current image 2100. The width of the third image 2130 is larger than the width of the current image 2100, and the height of the third image 2130 is smaller than the height of the current image 2100.
[0262] Since the images in the image sequence according to the embodiment may have various sizes, it is necessary to consider the size of the images in the case of performing inter-frame prediction using the temporal redundancy between images.
[0263] The acquirer 2010 may acquire the size information of the image to be decoded from at least one of the sequence parameter set, the picture parameter set, and the video parameter set. In an embodiment, the size of the image may be determined according to a temporal identifier (ID) (or temporal layer identifier) for supporting the temporal scalability of the image. When the size of the image is predetermined for each temporal ID, the prediction decoder 2030 may determine the size of the image by referring to the temporal ID obtained from the bitstream.
[0264] When the prediction mode of the current block included in the current image 2100 is an inter-frame mode that uses the temporal redundancy between the previously decoded image and the current image, the prediction decoder 2030 may generate a prediction sample corresponding to the current sample in the current block by considering the size of the current image 2100 and the size of the previously decoded image. The current block, which is a block generated by dividing an image according to a tree structure, may correspond to, for example, a largest coding unit, a coding unit, a transform unit, or a sub-unit divided from a coding unit.
[0265] In an embodiment, the prediction decoder 2030 may determine the size of the largest coding unit divided from the current image 2100 according to the size of the current image 2100. For example, the prediction decoder 2030 may determine the size of the largest coding unit that can be divided from the current image 2100 by applying the size of the current image 2100 to a specific calculation expression. Since the size of the largest coding unit is adaptively determined according to the size of the image, the load on the memory that occurs when data of the largest coding unit having a large size is written to / read from the memory can be reduced.
[0266] After generating a prediction sample through inter-frame prediction, when residual data is included in the bitstream, the reconstructed sample of the current block may be obtained by combining the residual data with the prediction sample; and when the residual data is not included in the bitstream, the prediction sample may be determined as the reconstructed sample.
[0267] In an embodiment, when the residual data obtained from the bitstream is inverse quantized, a transformer (not shown) may inverse-transform the inverse quantized residual data from the frequency domain to the spatial domain. In this case, the transformer may inverse-transform the residual data by using a transform method selected from various transform methods based on the size of the current image 2100.
[0268] The transformation method may include, but is not limited to, the multiple transform selection (MTS) method of adaptively selecting one transform kernel from various transform kernels (e.g., DCT type 2, DST type 7, and DCT type 8), the non-separable secondary transform (NSST) method of performing a transform and then selectively performing a transform on low-frequency components, the rotational transform (ROT) method, the discrete sine transform (DST) method, and the discrete cosine transform (DCT) method.
[0269] According to an embodiment, a transformer (not shown) may perform an inverse transform on the residual data by using any one of the transform methods according to the information indicating the transform method obtained from the bitstream.
[0270] The prediction decoder 2030 may reconstruct the current block by configuring a reference image list by using an image (hereinafter, a previous image) decoded earlier than the current block.
[0271] In an embodiment, the prediction decoder 2030 may configure the reference image list by using a previous image having a size larger than that of the current image 2100 and / or a previous image having the same size as the current image 2100 among the previous images. When a specific image is larger than the current image 2100, it may mean that both the width and height of the specific image are larger than those of the current image 2100. Alternatively, when a specific image is larger than the current image 2100, it may mean that either the width or the height is larger than that of the current image 2100, and the other of the width and height is the same as that of the current image 2100.
[0272] When the size of the reference image selected from the reference image list is larger than the size of the current image 2100, the samples existing in the reference image can be used as prediction samples. However, when the size of the reference image is smaller than the size of the current image 2100, the quality of the reconstructed samples may be degraded because the size of the reference image should be increased and then the prediction samples should be selected. In other words, when the size of the current block is 3x3 and the width and height of the reference image are twice the width and height of the current image 2100, the prediction samples can be obtained by using some of the samples included in the block with a size of 6x6 in the reference image. However, when the size of the current block is 6x6 and the width and height of the reference image are 1 / 2 of the width and height of the current image 2100, the block with a size of 3x3 in the reference image should be upsampled to a size of 6x6, and then the prediction samples should be obtained. That is to say, since new samples that do not exist in the reference image should be generated by upsampling the block with a size of 3x3 in the reference image, the quality of the reconstructed samples may be degraded. Therefore, the prediction decoder 203 can be configured to include only a reference image list of previous images having a size equal to or larger than the size of the current image 2100 to maintain the quality of the reconstructed samples generated according to the inter-frame prediction.
[0273] In another embodiment, the prediction decoder 2030 can configure the reference image list by using previous images having a size larger than the current image 2100, previous images having a size smaller than the current image 2100, and / or previous images having a size equal to the current image 2100 among the previous images.
[0274] The prediction decoder 2030 obtains the motion vector of the current block to obtain the prediction samples from the reference image. To obtain the motion vector, the prediction decoder 2030 can configure a candidate list including the motion vectors of the neighboring blocks related to the current block as candidate motion vectors.
[0275] The neighboring blocks can include spatial domain blocks adjacent to the current block in the current image 2100 and temporal domain blocks located in a collocated image selected from the images included in the reference image list.
[0276] Figure 22 is a diagram showing the positions of the neighboring blocks related to the current block 2200. Figure 23 is a table showing the candidate list.
[0277] Reference Figure 22 , the neighboring blocks of the current block 2200 can include spatial domain blocks (e.g., A0, A1, B0, B1, and B2) adjacent to the current block 2200 spatially and temporal domain blocks (e.g., Col and Br) adjacent to the current block 2200 temporally.
[0278] Specifically, the spatial domain block may include at least one of a lower left block A0, a lower left block A1, an upper right block B0, an upper right block B1, and an upper left block B2.
[0279] The temporal domain block may include at least one of a block Col in the collocated image that is at the same point as the current block and a block Br that is spatially adjacent to the block Col at the same point, where the collocated image has a picture order count (POC) different from that of the current image 2100 including the current block 2200. The block Br may be located at the lower right of the block Col that is at the same point as the current block. The block Col that is at the same point as the current block may be a block among the pixels included in the collocated image that includes a pixel corresponding to the central pixel in the current block.
[0280] Figure 22 The positions of the temporal domain block and the spatial domain block shown are merely examples, and according to the embodiments, the positions and numbers of the temporal domain block and the spatial domain block may be modified in various ways.
[0281] The prediction decoder 2030 may determine the availability of adjacent blocks in a specific order and may sequentially include the motion vectors of the adjacent blocks in the candidate list as candidate motion vectors according to the determined results.
[0282] When an adjacent block is intra-frame predicted, the prediction decoder 2030 may determine that the adjacent block is unavailable.
[0283] In an embodiment, when an image having the same size as the current image 2100 does not exist in the images included in the reference image list, the prediction decoder 2030 may determine that the temporal domain block is unavailable. In this case, the motion vector of the temporal domain block is not included in the candidate list. On the contrary, when an image having the same size as the current image 2100 exists in the images included in the reference image list, the motion vector of the temporal domain block in the collocated image may be included in the candidate list as a candidate motion vector. In this case, an image having the same size as the current image may be selected from the images included in the reference image list as the collocated image.
[0284] In another embodiment, when a previous image having the same size as the current image 2100 does not exist in the previous images stored in the decoded picture buffer (DPB), the prediction decoder 2030 may determine that the temporal block is unavailable and may not include the motion vector of the temporal block in the candidate list. Instead, when a previous image having the same size as the current image 2100 exists in the previous images stored in the DPB, the prediction decoder 2030 may include the motion vector of the temporal block in the collocated image as a candidate motion vector in the candidate list. In this case, an image having the same size as the current image may be selected as the collocated image from among the images included in the reference image list.
[0285] When an image having the same size as the current image 2100 is not included in the reference image list or the DPB, the reason that the motion vector of the temporal block is not included in the candidate list is high computational complexity. Specifically, the motion vector of the temporal block in the collocated image corresponds to the difference between the position of the temporal block and the position of the block referred to by the temporal block. When the collocated image and the reference image of the temporal block are larger or smaller than the current image 2100 and the reference image of the current block, the motion vector of the temporal block should be decreased or increased according to the size of the current image 2100. That is, the motion vector of the temporal block should be changed by considering all of the sizes of the collocated image, the reference image of the temporal block, the current image 2100, and the reference image of the current block.
[0286] In Figure 23 , the motion vectors of block A1, block B0, block B2, and block Col are included as candidates in the candidate list.
[0287] When the motion vectors of adjacent blocks are included in the candidate list, the prediction decoder 2030 may determine the order in which the motion vectors are included in the candidate list based on the size of the reference image indicated by the motion vectors of the adjacent blocks.
[0288] For example, a low index (i.e., high priority) may be assigned to an adjacent block having a motion vector indicating a reference image of the same size as the current image 2100, and a high index (i.e., low priority) may be assigned to an adjacent block having a motion vector indicating a reference image smaller than the current image 2100.
[0289] In another example, the lowest index (i.e., the highest priority) may be assigned to an adjacent block having a motion vector indicating a reference image with the same size as the current image 2100, the middle index (i.e., the medium priority) may be assigned to an adjacent block having a motion vector indicating a reference image with a size larger than the current image 2100, and the highest index (i.e., the lowest priority) may be assigned to an adjacent block having a motion vector indicating a reference image with a size smaller than the current image 2100. When the number of adjacent blocks each having a motion vector indicating a reference image with a size larger (or smaller) than the current image 2100 is 2 or more, a lower index may be assigned to the motion vector indicating a reference image whose size is closer to the size of the current image 2100.
[0290] The prediction decoder 2030 may obtain the motion vector of the current block by using the candidate motion vector indicated by the information obtained from the bitstream among the candidate motion vectors included in the candidate list. For example, the prediction decoder 2030 may determine the candidate motion vector selected in the candidate list as the motion vector of the current block. In another example, the prediction decoder 2030 may obtain the motion vector of the current block by changing the candidate motion vector according to the information indicating the differential motion vector obtained from the bitstream.
[0291] In an embodiment, the information indicating the differential motion vector obtained from the bitstream may include information indicating a change distance and information indicating a change direction. In this case, the prediction decoder 2030 may obtain the motion vector of the current block by changing the candidate motion vector selected in the candidate list according to the change distance and the change direction.
[0292] The information indicating the change distance may include an index, and the change distance corresponding to each index value may be determined in advance. For example, an index of 0 may indicate a change distance of 1, an index of 1 may indicate a change distance of 2, and an index of 2 may indicate a change distance of 4.
[0293] The prediction decoder 2030 may scale the change distance corresponding to the index value by considering the size of the current image 2100. For example, when the size of the current image 2100 is equal to or larger than a preset size, the prediction decoder 2030 may increase the change distance corresponding to each index. In another example, when the height of the current image 2100 is equal to or larger than a preset value and the width of the current image 2100 is smaller than the preset value, the prediction decoder 2030 may increase the change distance corresponding to each index when the change direction is the height direction, and may maintain the change distance corresponding to each index when the change direction is the width direction.
[0294] Since the prediction decoder 2030 according to the embodiment adaptively determines the change distance by considering various sizes of the current image 2100, the prediction decoder 2030 can more accurately determine the motion vector of the current block.
[0295] The prediction decoder 2030 can select reference samples in the reference image by considering the motion vector of the current block, and can reconstruct the current block by using the reference samples. The reference samples can be integer pixels in the reference image.
[0296] Now, reference will be made to Figure 24 and Figure 25 to describe a method of selecting reference samples in the reference image.
[0297] Figure 24 FIG. shows a method of selecting a reference sample 2450 when the size of the reference image 2400 is the same as the size of the current image 2100.
[0298] When the size of the current block 2200 is 2x2 and the current image 2100 and the reference image 2400 have the same size, the size of the reference sample 2450 should also be 2x2. This is because four prediction samples are used to reconstruct the values of four current samples. When the size of the reference sample 2450 is 2x2, it means that the size of the block including the reference sample 2450 is 2x2. In addition, when the current image 2100 and the reference image 2400 have the same size, it means that the width and height of the current image 2100 are the same as the width and height of the reference image 2400.
[0299] The prediction decoder 2030 selects the top-left reference sample 2451 in the reference image 2400 by applying the motion vector mv of the current block 2200 to the position of the top-left current sample 2201 among the current samples included in the current block 2200. Next, the prediction decoder 2030 can obtain the reference sample 2450 having a 2x2 size by selecting the remaining reference samples adjacent to the top-left reference sample 2451.
[0300] In Figure 24 it is found that since the reference image 2400 and the current image 2100 have the same size, the reference samples 2450 are adjacent to each other. That is, one of the reference samples among the reference samples 2450 is separated from the closest reference sample by a distance (or coordinate value) of 1. For example, when the position of the reference sample is (a, b), the position of the reference sample to the right of the reference sample can be (a + 1, b), and the position of the reference sample below the reference sample can be (a, b + 1).
[0301] The prediction decoder 2030 may generate filtered samples by filtering the reference samples 2450 using an n-tap filter (n is a natural number, e.g., 8), and may determine the prediction samples of the current block 2200 from the filtered samples. The filtered samples may be fractional pixels. In a codec such as HEVC, interpolation for generating fractional pixels using integer pixels is used, and thus a detailed description thereof will be omitted.
[0302] In an embodiment, when the size of the reference image 2400 is the same as the size of the current image 2100, the prediction decoder 2030 may not filter the reference samples 2450, and may determine the prediction samples from the reference samples 2450. For example, the prediction decoder 2030 may determine the reference samples 2450 as the prediction samples, or may adjust the sample values of the reference samples 2450, and then may generate the prediction samples with the adjusted values.
[0303] Alternatively, in an embodiment, when the size of the reference image 2400 is the same as the size of the current image 2100 and the value indicating the position of the fractional pixel is not 0, the prediction decoder 2030 may generate filtered samples by filtering the reference samples 2450 using an n-tap filter (n is a natural number), and may generate the prediction samples of the current block 2200 from the filtered samples. When the value indicating the position of the fractional pixel is 0, the prediction decoder 2030 may not filter the reference samples 2450, and may generate the prediction samples from the reference samples 2450. The value indicating the position of the fractional pixel may be calculated based on the motion vector of the current block 2100 according to a predetermined arithmetic expression.
[0304] Figure 25 A method of selecting reference samples when the size of the reference image 2500 is larger than the size of the current image 2100 is shown.
[0305] When the size of the current block 2200 is 2x2 and the width and height of the reference image 2500 are twice the width and height of the current image 2100, the size of the block 2550 corresponding to the current block 2200 in the reference image 2500 is 4x4. Since the number of prediction samples should be the same as the number of current samples, the block 2550 with a size of 4x4 should be downsampled to a size of 2x2.
[0306] In an embodiment, the prediction decoder 2030 determines a position 2501 by applying a motion vector mv to the position of the top-left current sample 2201 in the current block 2200. Since the size of the reference image 2500 is twice the size of the current image 2100, the position 2501 indicated by the motion vector should be changed according to the result of the size comparison between the reference image 2500 and the current image 2100. That is, the prediction decoder 2030 can change the position 2501 determined by applying the motion vector to the position of the top-left current sample 2201 according to the size comparison result, and can select a sample corresponding to the changed position as the top-left reference sample 2551. The size comparison result can be the ratio between the width of the reference image 2500 and the width of the current image 2100 and the ratio between the height of the reference image 2500 and the height of the current image 2100.
[0307] Reference Figure 25 , when the motion vector is (0, 0), the position determined by applying the motion vector to the position (2, 2) of the top-left current sample 2201 is (2, 2). When (2, 2) is multiplied by 2 (which is the ratio between the height of the reference image 2500 and the height of the current image 2100) and 2 (which is the ratio between the width of the reference image 2500 and the width of the current image 2100), the position (4, 4) can be derived, and the top-left reference sample 2551 corresponding to the position (4, 4) can be identified. When the ratio between the height of the reference image 2500 and the height of the current image 2100 is 2 and the ratio between the width of the reference image 2500 and the width of the current image 2100 is 1, the top-left reference sample having the position (4, 2) derived by multiplying (2, 2) by 2 and 1 can be identified.
[0308] When the top-left reference sample 2551 is selected, the prediction decoder 2030 can select the remaining reference samples 2552, 2553, and 2554 separated from the top-left reference sample 2551 by a specific interval. The specific interval can be determined according to the result of the size comparison between the reference image 2500 and the current image 2100. The size comparison result can be the ratio between the width of the reference image 2500 and the width of the current image 2100 and the ratio between the height of the reference image 2500 and the height of the current image 2100. For example, when the ratio between the height of the reference image 2500 and the height of the current image 2100 is 2 and the ratio between the width of the reference image 2500 and the width of the current image 2100 is 2, the specific interval can be determined to be 2 in the height direction and 2 in the width direction.
[0309] The prediction decoder 2030 can select the reference samples 2552, 2553, and 2554 separated from the top-left reference sample 2551 by a specific interval according to the number of current samples. ReferenceFigure 25 The prediction decoder 2030 may select the upper left reference sample 2551 having the position (4, 4), the reference sample 2552 having the position (6, 4), the reference sample 2553 having the position (4, 6), and the reference sample 2554 having the position (6, 6).
[0310] When the reference samples 2551, 2552, 2553, and 2554 are obtained from a reference image 2500 having a size different from that of the current image 2100, the prediction decoder 2030 may apply an n-tap filter (n is a natural number, e.g., 6, 8, or 10) to the reference samples 2551, 2552, 2553, and 2554 by considering the result of the size comparison between the current image 2100 and the reference image 2500. The filtered samples generated as a result of filtering the reference samples 2551, 2552, 2553, and 2554 may include at least one of integer pixels and fractional pixels.
[0311] In an embodiment, the prediction decoder 2030 may select the coefficients of the n-tap filter to be used for filtering each of the reference samples 2551, 2552, 2553, and 2554 according to the result of the size comparison (e.g., height ratio and width ratio) between the current image 2100 and the reference image 2500.
[0312] For example, when the height (or width) ratio between the current image 2100 and the reference image 2500 is equal to or greater than a preset value, the prediction decoder 2030 may filter each of the reference samples 2551, 2552, 2553, and 2554 by using the filter "a", and when the height (or width) ratio between the current image 2100 and the reference image 2500 is less than the preset value, the prediction decoder 2030 may filter each of the reference samples 2551, 2552, 2553, and 2554 by using the filter "b". The filter coefficients of the filter "a" may be different from the filter coefficients of the filter "b".
[0313] Figure 26 is a table showing the filter coefficients according to the result of the size comparison between the current image 2100 and the reference image.
[0314] As Figure 26As shown, when the height (or width) ratio between the current image 2100 and the reference image is equal to or greater than 1.75, a filtered sample can be generated by applying an 8-tap filter with filter coefficients of 0, -5, 15, 41, 19, -5, -1, and 0 to the reference sample. When the height (or width) ratio between the current image 2100 and the reference image is equal to or greater than 1.25 and less than 1.75, a filtered sample can be generated by applying an 8-tap filter with filter coefficients of -4, 0, 19, 29, 21, 5, -4, and -2 to the reference sample. In addition, when the height (or width) ratio between the current image 2100 and the reference image is less than 1.25, a filtered sample can be generated by applying an 8-tap filter with filter coefficients of 0, 1, -3, 63, 4, -2, 1, and 0 to the reference sample.
[0315] Although only one set of filter coefficients corresponding to each of the size ratios between the current image 2100 and the reference image is shown in Figure 26 , as described below with reference to Figure 29 , several sets of filter coefficients corresponding to the values indicating fractional pixels can be specified for each size ratio.
[0316] Figures 27A to 27D shows a method of generating a filtered sample by applying an n-tap filter to the reference samples 2551, 2552, 2553, and 2554 of Figure 25 .
[0317] Although in Figures 27A to 27D , the filter in the width direction is applied to the samples to the left and right of the reference samples 2551, 2552, 2553, and 2554, the filter coefficients of the filter in the width direction can be determined according to the ratio between the width of the current image 2100 and the width of the reference image.
[0318] When the filter in the height direction is applied to the samples above and below the reference samples 2551, 2552, 2553, and 2554, the filter coefficients of the filter in the height direction can be determined according to the ratio between the height of the current image 2100 and the height of the reference image.
[0319] As Figure 27A shown, a filtered sample corresponding to the first reference sample 2551 is generated by applying the filter 2610 to the first reference sample 2551 and the adjacent samples. As Figure 27B shown, a filtered sample corresponding to the second reference sample 2552 is generated by applying the filter 2610 to the second reference sample 2552 and the adjacent blocks. Similarly, as Figure 27C and Figure 27DAs shown, filtered samples corresponding to the third reference sample 2553 and the fourth reference sample 2554 are generated by applying a filter 2610 to the third reference sample 2553 and adjacent samples and the fourth reference sample 2554 and adjacent samples.
[0320] According to an embodiment, downsampling and interpolation of a block corresponding to the current block 2200 can be simply performed by applying an n - tap filter at a specific interval.
[0321] Although Figure 25 in the reference image 2500, the block 2550 corresponding to the current block 2200 is downsampled in units of blocks, according to an embodiment, when the size of the reference image 2500 is different from the size of the current image 2100, downsampling or upsampling can be performed so that the size of the reference image 2500 is the same as the size of the current image 2100, and then the reference samples can be selected as shown in the method of Figure 24 .
[0322] Figure 28 FIG. is a diagram for describing a method of generating a prediction sample when the sizes of a reference image and a current image are different from each other. Figure 29 is a diagram showing Figure 28 the filter coefficients of an n - tap filter for filtering the reference samples of
[0323] In Figure 28 , r0 to r15 may indicate integer pixels in the reference image, and c0 to c9 may indicate integer pixels in the current image.
[0324] When it is assumed that the current image and the reference image include one - dimensional samples, the reference samples r5, r6, r8, and r10 corresponding to the current samples c3, c4, c5, and c6 can be selected according to the motion vector and the result of comparing the sizes between the current image and the reference image.
[0325] As described above, when the size of the reference image is larger than the size of the current image, the reference samples r5, r6, r8, and r10 may be spaced apart at an interval corresponding to the result of comparing the sizes between the reference image and the current image (e.g., size ratio). In Figure 28 , since it is assumed that the size ratio between the reference image and the current image is 1.6 and is not a natural number, r5 and r6 may be adjacent to each other, and r6 and r8, and r8 and r10 may be spaced apart by a distance of 2.
[0326] When the reference image is interpolated in units of 1 / 16 pixels, the positions of the fractional pixels corresponding to r5, r6, r8, and r10 can be 3, 13, 6, and 0, respectively. The values indicating the positions of the fractional pixels can be calculated based on the motion vectors of the current block including the current samples c3, c4, c5, and c6 according to a predetermined arithmetic expression.
[0327] In Figure 29 the prediction decoder 2030 can obtain the filtered samples corresponding to the positions of the fractional pixels, i.e., the prediction samples p3, p4, p5, and p6, by applying the filter coefficients corresponding to the positions of the fractional pixels to the integer pixels in the reference image.
[0328] The prediction decoder 2030 can obtain the prediction samples p3, p4, p5, and p6 according to Equation 1.
[0329]
Equation 1
[0330] p3 = (r2 * f L [3][0] + r3 * f L [3][1] + r4 * fL[3][2] + r5 * f L [3][3] + r6 * f L [3][4] + r7 * f L [3][5] + r8 * f L [3][6] + r9 * f L [31[7] + offset) >> shift
[0331] p4 = (r3 * f L
[13] [0] + r4 * f L
[13] [1] + r5 * f L
[13] [2] + r6 * f L
[13] [3] + r7 * f L
[13] [4] + r8 * f L
[13] [5] + r9 * f L
[13] [6] + r10 * f L
[13] [7] + offset) >> shift
[0332] p5 = (r5 * f L [6][0] + r6 * f L [6][1] + r7 * f L [6][2] + r8 * f L [6][3] + r9 * f L [6][4] + r10 * f L [6][5] + r11 * f L[6][6]+r12*f L [6][7]+offset) >> shift
[0333] p6 = (r7*f L [0][0]+r8*f L [0][1]+r9*f L [0][2]+r10*f L [0][3]+r11*f L [0][4]+r12*f L [0][5]+r13*f L [0][6]+r14*f L [0][7]+offset) >> shift
[0334] In Equation 1, shift is "displacement" and offset is "offset".
[0335] In Equation 1, shift is a predetermined value. Referring to Equation 1, it is found that even when the position of the fractional pixel corresponding to r10 is 0, that is, when an integer pixel is indicated, an 8-tap filter is applied to adjacent integer pixels. Although it has been described that when the sizes of the current image and the reference image are the same and the value indicating the position of the fractional pixel is 0, the n-tap filter is not applied to the reference sample, but because in Figure 28 the sizes of the current image and the reference image are different from each other, so even when the value indicating the position of the fractional pixel is 0, adjacent samples are filtered to improve the prediction accuracy.
[0336] When the prediction mode of the current block is the combined inter-intra prediction (CIIP) mode, the prediction decoder 2030 can reconstruct the current block by performing a weighted sum of the prediction samples obtained by inter-frame prediction (referred to as inter-frame prediction samples) and the prediction samples obtained by intra-frame prediction (referred to as intra-frame prediction samples). In this case, the weights to be applied to the inter-frame prediction samples and the intra-frame prediction samples can be determined in advance, and the sum of the weight to be applied to the inter-frame prediction samples and the weight to be applied to the intra-frame prediction samples can be constant.
[0337] The prediction decoder 2030 can change the weights to be applied to the inter-frame prediction samples and the intra-frame prediction samples according to the result of the size comparison between the current image 2100 and the reference image.
[0338] For example, when the size of the reference image is smaller than the size of the current image 2100, i.e., when the blocks in the reference image should be upsampled for inter-frame prediction, the prediction decoder 2030 may reduce the weight to be applied to the inter-frame prediction samples and may increase the weight to be applied to the intra-frame prediction samples. This is because when the blocks are upsampled, the reliability of the inter-frame prediction samples decreases.
[0339] In another embodiment, when the size of the reference image is equal to or larger than the size of the current image 2100, the prediction decoder 2030 may increase the weight to be applied to the inter-frame prediction samples and may reduce the weight to be applied to the intra-frame prediction samples. This is because the prediction samples obtained from the reference image with a size larger than or equal to the current image 2100 have high reliability.
[0340] In another embodiment, when the size of the reference image is equal to or larger than the size of the current image 2100, the prediction decoder 2030 increases the weight to be applied to the inter-frame prediction samples. In this case, the weight increment when the size of the reference image is the same as the size of the current image 2100 may be larger than the weight increment when the size of the reference image is larger than the size of the current image 2100.
[0341] In another embodiment, when the size of the reference image is the same as the size of the current image 2100, the prediction decoder 2030 may increase the weight to be applied to the inter-frame prediction samples and may reduce the weight to be applied to the intra-frame prediction samples. On the contrary, when the size of the reference image is different from the size of the current image 2100, the prediction decoder 2030 may reduce the weight to be applied to the inter-frame prediction samples and may increase the weight to be applied to the intra-frame prediction samples.
[0342] In another embodiment, the prediction decoder 2030 may determine the weight to be applied to the inter-frame prediction samples according to the size ratio between the reference image and the current image 2100, and may determine the weight to be applied to the intra-frame prediction samples based on the determined weight. That is, the prediction decoder 2030 may adaptively determine the weight according to the size ratio between the reference image and the current image 2100.
[0343] In an embodiment, when the prediction mode of the current block is the bi-directional prediction mode using the first reference image included in the reference image list 0 and the second reference image included in the reference image list 1, the prediction decoder 2030 may reconstruct the current block by performing weighted summation on the first prediction samples obtained from the first reference image and the second prediction samples obtained from the second reference image. In this case, the weights to be applied to the first prediction samples and the second prediction samples may be determined in advance, and the sum of the weight to be applied to the first prediction samples and the weight to be applied to the second prediction samples may be constant.
[0344] The prediction decoder 2030 may change the weights to be applied to the first prediction sample and the second prediction sample based on the result of the size comparison between the first reference image and the second reference image.
[0345] For example, when the size of the first reference image is equal to or greater than the size of the current image 2100 and the size of the second reference image is smaller than the size of the current image 2100, the prediction decoder 2030 may increase the weight to be applied to the first prediction sample and may decrease the weight to be applied to the second prediction sample.
[0346] In another embodiment, when the size of the first reference image is the same as the size of the current image 2100 and the size of the second reference image is different from the size of the current image 2100, the prediction decoder 2030 may increase the weight to be applied to the first prediction sample and may decrease the weight to be applied to the second prediction sample.
[0347] In an embodiment, when the prediction mode of the current block is an affine skip mode or an affine merge mode, the prediction decoder 2030 may unidirectionally predict the current block by using the first reference image included in the reference image list 0 or the second reference image included in the reference image list 1. When the information indicating the prediction direction of the current block obtained from the bitstream indicates bidirectionality, the prediction decoder 2030 may select any one of the first reference image included in the reference image list 0 and the second reference image included in the reference image list 1, and may unidirectionally predict the current block by using the selected reference image.
[0348] Specifically, when the prediction direction of the current block is bidirectional, the prediction decoder 2030 may unidirectionally predict the current block by using the reference image having the same size as the current image 2100 among the first reference image and the second reference image. When both the first reference image and the second reference image have sizes different from the current image 2100, the prediction decoder 2030 may unidirectionally predict the current block by using the reference image having a size larger than the current image 2100 among the two reference images; or when both the first reference image and the second reference image have sizes larger than the current image 2100, the prediction decoder 2030 may unidirectionally predict the current block by using the reference image whose size is closer to the current image 2100.
[0349] When the prediction direction of the current block is unidirectional and the size of the reference image identified from the bitstream is smaller than the size of the current image 2100, the prediction decoder 2030 may unidirectionally predict the current block by using an image included in the reference image list that has a size equal to or larger than the current image 2100 (instead of using the reference image identified from the bitstream) as the reference image.
[0350] When obtaining the information indicating the prediction mode of the current block, the acquirer 2010 may consider the size of the current image 2100 and / or the reference image.
[0351] For example, when the size of the current image 2100 and / or the reference image is equal to or smaller than a preset size, the acquirer 2010 may not obtain from the bitstream the information (e.g., flag) indicating whether to apply a specific prediction mode. A specific prediction mode that is a mode using the temporal redundancy between images (i.e., a mode using motion vectors) may be, for example but not limited to, the merge mode, the skip mode, the CIIP mode, the affine mode, the decoder-side motion vector refinement (DMVR) mode, or the bi-directional prediction mode. The DMVR mode is a mode in which the decoder directly corrects the motion vector obtained from the encoder signaling through block matching or the like.
[0352] In another embodiment, when the size of the current image 2100 and / or the reference image is equal to or smaller than a preset size, if it is identified from the information indicating whether to apply other prediction modes that other prediction modes are not applied to the current block, the acquirer 2010 may obtain from the bitstream the information indicating whether to apply a specific prediction mode. That is, the acquirer 2010 may delay the order of obtaining the information indicating whether to apply a specific prediction mode.
[0353] In another embodiment, when the sizes of the reference image and the current image 2100 are different from each other, the acquirer 2010 may not obtain from the bitstream the information (e.g., flag) indicating whether to apply a specific prediction. The specific prediction mode may be, for example but not limited to, the merge mode, the skip mode, the CIIP mode, the affine mode, the DMVR mode, or the bi-directional prediction mode.
[0354] In another example, when the sizes of the reference image and the current image 2100 are different from each other, if it is identified from the information indicating whether to apply other prediction modes that other prediction modes are not applied to the current block, the acquirer 2010 may obtain from the bitstream the information indicating whether to apply a specific prediction mode.
[0355] Figure 30 is a diagram for describing an image decoding method according to an embodiment.
[0356] In operation S3010, the image decoding apparatus 2000 compares the size of the current image 2100 including the current block with the size of a reference image. As a result of the size comparison, the image decoding apparatus 2000 may derive a size ratio between the current image and the reference image.
[0357] In an embodiment, the image decoding apparatus 2000 may identify the size of the current image 2100 and the size of the reference image based on size information included in the bitstream. The size information may be a temporal ID of the image. In this case, the image decoding apparatus 2000 may identify the size of the current image 2100 and the size of the reference image based on the temporal ID of the current image 2100 and the temporal ID of the reference image.
[0358] The image decoding apparatus 2000 may configure a reference image list including images decoded before the current image 2100, and may select, as a reference image for the current block, an image identified from information included in the bitstream among the images included in the reference image list.
[0359] In operation S3020, the image decoding apparatus 2000 selects a reference sample corresponding to a current sample in the current block in the reference image according to a motion vector of the current block. When the size of the reference image is larger than the size of the current image 2100, the reference samples may be spaced apart by an interval corresponding to the result of the size comparison between the current image 2100 and the reference image in the reference image.
[0360] Reference has been made to Figure 24 and Figure 25 a method of selecting a reference sample by considering a size ratio between the current image 2100 and the reference image, and thus a detailed description thereof will be omitted.
[0361] To determine a motion vector of the current block, the image decoding apparatus 2000 may configure a candidate list including motion vectors of adjacent blocks related to the current block as candidate motion vectors. The adjacent blocks may include a spatial domain block adjacent to the current block in the current image 2100 and a temporal domain block in a collocated image selected from among the images included in the reference image list.
[0362] In an embodiment, when an image having the same size as the current image 2100 does not exist in the images included in the reference image list, the image decoding apparatus 2000 may determine that the temporal block is unavailable. In this case, the motion vector of the temporal block is not included in the candidate list. On the contrary, when an image having the same size as the current image 2100 exists in the images included in the reference image list, the motion vectors of the blocks in the collocated image may be included in the candidate list as candidate motion vectors. In this case, an image having the same size as the current image may be selected from the images included in the reference image list as the collocated image.
[0363] In another embodiment, when a previous image having the same size as the current image 2100 does not exist in the previous images stored in the decoded picture buffer (DPB), the image decoding apparatus 2000 may determine that the temporal block is unavailable and may not include the motion vector of the temporal block in the candidate list. On the contrary, when a previous image having the same size as the current image 2100 exists in the previous images stored in the DPB, the image decoding apparatus 2000 may include the motion vectors of the blocks in the collocated image in the candidate list as candidate motion vectors. In this case, an image having the same size as the current image may be selected from the images included in the reference image list as the collocated image.
[0364] In operation S3030, the image decoding apparatus 2000 reconstructs the current block based on the reference samples.
[0365] The image decoding apparatus 2000 may generate filtered samples by interpolating the reference samples and may generate prediction samples of the current block from the filtered samples. Filter coefficients for interpolating the reference samples may be selected according to the result of the size comparison between the current image 2100 and the reference image.
[0366] When residual data is included in the bitstream, the image decoding apparatus 2000 may generate reconstructed samples of the current block by combining the residual data with the prediction samples, and when the residual data is not included in the bitstream, the image decoding apparatus 2000 may determine the prediction samples as the reconstructed samples.
[0367] Figure 31 is a block diagram showing the configuration of an image encoding apparatus 3100 according to an embodiment.
[0368] Reference Figure 31 , the image encoding apparatus 3100 may include a prediction encoder 3110 and a generator 3130. Figure 31 The prediction encoder 3110 of Figure 2 may correspond to Figure 2bitstream generator 210.
[0369] According to an embodiment, the prediction encoder 3110 and the generator 3130 can be implemented as at least one processor. The image encoding apparatus 3100 may include one or more memories (not shown) that store the input / output data of the prediction encoder 3110 and the generator 3130. In addition, the image encoding apparatus 3100 may include a memory controller (not shown) that controls the data input / output of the memory (not shown).
[0370] The prediction encoder 3110 encodes an image according to a prediction mode, and the generator 3130 generates a bitstream including information generated as a result of encoding the image.
[0371] The prediction encoder 3110 may determine a prediction mode of a current block determined in the current image 2100. The prediction mode of the current block may include an intra mode, a merge mode, an advanced motion vector prediction (AMVP) mode, a skip mode, a CIIP mode, an affine mode, a decoder-side motion vector refinement (DMVR) mode, or a bi-prediction mode.
[0372] In an embodiment, the prediction encoder 3110 may determine the prediction mode of the current block by considering the size of the current image 2100 and / or a reference image.
[0373] For example, when the size of the current image 2100 and / or the reference image is equal to or less than a preset size, the prediction encoder 3110 may determine that a specific prediction mode is not applied to the current block, and the generator 3130 may not include information (e.g., a flag) indicating whether the specific prediction mode is applied in the bitstream. A specific prediction mode that is a mode using temporal redundancy between images (i.e., a mode using a motion vector) may be, for example but not limited to, a merge mode, a skip mode, a CIIP mode, an affine mode, a decoder-side motion vector refinement (DMVR) mode, or a bi-prediction mode.
[0374] In another example, when the size of the current image 2100 and / or the reference image is equal to or less than a preset size and it is determined that no other prediction mode is applied to the current block, the prediction encoder 3110 may determine whether to apply a specific prediction mode to the current block, and the generator 3130 may include information (e.g., a flag) indicating whether the specific prediction mode is applied in the bitstream. That is, the order of determining whether to apply a specific prediction mode may be delayed.
[0375] In another example, when the size of the reference image and the size of the current image 2100 are different from each other, the prediction encoder 3110 may determine that a specific prediction mode is not applied to the current block, and the generator 3130 may not include in the bitstream information indicating whether the specific prediction mode is applied.
[0376] In another example, when the size of the reference image and the size of the current image 2100 are different from each other and it is determined that no other prediction mode is applied to the current block, the prediction encoder 3110 may determine whether to apply a specific prediction mode to the current block, and the generator 3130 may include in the bitstream information indicating whether the specific prediction mode is applied.
[0377] When the prediction mode of the current block included in the current image 2100 is a mode that uses temporal redundancy between the current image 2100 and the previously decoded image, the prediction encoder 3110 may generate prediction samples corresponding to the current samples in the current block by considering the size of the current image 2100 and the size of the previously decoded image. The current block, which is a block generated by dividing an image according to a tree structure, may correspond to, for example, a largest coding unit, a coding unit, a transform unit, or a block that is a sub-unit divided from the coding unit.
[0378] In an embodiment, the prediction encoder 3110 may determine the size of the largest coding unit divided from the current image 2100 according to the size of the current image 2100. For example, the prediction encoder 3110 may determine the size of the largest coding unit that can be divided from the current image 2100 by applying the size of the current image to a specific arithmetic expression.
[0379] The prediction encoder 3110 may encode the current block by configuring a reference image list using an image that was encoded earlier than the current block (hereinafter referred to as a previous image).
[0380] In an embodiment, the prediction encoder 3110 may configure the reference image list by using previous images among the previous images whose size is greater than and / or equal to the size of the current image 2100.
[0381] In another embodiment, the prediction encoder 3110 may configure the reference image list by using previous images among the previous images whose size is greater than the current image, previous images whose size is less than the current image 2100, and / or previous images whose size is the same as the current image 2100.
[0382] The prediction encoder 3110 may select a reference sample similar to the current block by searching the reference image, and may encode the motion vector indicating the selected reference sample.
[0383] As Figure 24As shown, when the size of the current image 2100 is the same as the size of the reference image, the prediction encoder 3110 selects, in the reference image, a reference sample corresponding to the current sample included in the current block.
[0384] The prediction encoder 3110 may generate a filtered sample by filtering the reference sample, and may obtain a prediction sample of the current block based on the filtered sample.
[0385] As Figure 25 shown, when the size of the reference image is larger than the size of the current image 2100, the prediction encoder 3110 may select reference samples separated by a specific interval in the reference image. The specific interval may be determined according to the result of the size comparison between the reference image and the current image 2100, and the size comparison result may be the ratio between the width of the reference image and the width of the current image 2100 and the ratio between the height of the reference image and the height of the current image 2100. For example, when the ratio between the height of the reference image and the height of the current image 2100 is 2, and the ratio between the width of the reference image and the width of the current image 2100 is 2, the specific interval may be determined to be 2 in the height direction and 2 in the width direction.
[0386] When obtaining a reference sample from a reference image whose size is different from that of the current image 2100, the prediction encoder 3110 may filter the reference sample by using an n-tap filter by considering the result of the size comparison between the current image 2100 and the reference image. The n-tap filter may be, for example, a 6-tap filter, an 8-tap filter, or a 10-tap filter.
[0387] In an embodiment, the prediction encoder 3110 may select the coefficients of the filter for filtering the reference sample according to the result of the size comparison (e.g., height ratio and width ratio) between the current image 2100 and the reference image.
[0388] For example, when the height (or width) ratio between the current image 2100 and the reference image is equal to or greater than a preset value, the prediction encoder 3110 may filter the reference sample by using filter "a", and when the height (or width) ratio between the current image 2100 and the reference image is less than the preset value, the prediction encoder 3110 may filter the reference sample by using filter "b". The filter coefficients of filter "a" may be different from those of filter "b".
[0389] When the prediction mode of the current block is the combined inter-frame intra-frame prediction (CIIP) mode, the prediction encoder 3110 may encode the current block by performing a weighted sum of the prediction samples obtained by inter-frame prediction (referred to as inter-frame prediction samples) and the prediction samples obtained by intra-frame prediction (referred to as intra-frame prediction samples). In this case, the weights to be applied to the inter-frame prediction samples and the intra-frame prediction samples may be determined in advance, and the sum of the weight to be applied to the inter-frame prediction samples and the weight to be applied to the intra-frame prediction samples may be constant.
[0390] The prediction encoder 3110 may change the weights to be applied to the inter-frame prediction samples and the intra-frame prediction samples according to the result of the size comparison between the current image 2100 and the reference image.
[0391] For example, when the size of the reference image is smaller than the size of the current image 2100, the prediction encoder 3110 may decrease the weight to be applied to the inter-frame prediction samples and may increase the weight to be applied to the intra-frame prediction samples.
[0392] In another example, when the size of the current image is equal to or larger than the size of the current image 2100, the prediction encoder 3110 may increase the weight to be applied to the inter-frame prediction samples and may decrease the weight to be applied to the intra-frame prediction samples.
[0393] In another example, when the size of the reference image is equal to or larger than the size of the current image 2100, the prediction encoder 3110 increases the weight to be applied to the inter-frame prediction samples. In this case, the weight increment when the size of the reference image is the same as the size of the current image 2100 may be larger than the weight increment when the size of the reference image is larger than the size of the current image 2100.
[0394] In another example, when the size of the reference image is the same as the size of the current image 2100, the prediction encoder 3110 may increase the weight to be applied to the inter-frame prediction samples and may decrease the weight to be applied to the intra-frame prediction samples. On the contrary, when the size of the reference image is different from the size of the current image 2100, the prediction encoder 3110 may decrease the weight to be applied to the inter-frame prediction samples and may increase the weight to be applied to the intra-frame prediction samples.
[0395] In another example, the prediction encoder 3110 may determine the weight to be applied to the inter-frame prediction samples according to the size ratio between the reference image and the current image 2100, and may determine the weight to be applied to the intra-frame prediction samples based on the determined weight.
[0396] In an embodiment, when the prediction mode of the current block is the bi - directional prediction mode using a first reference image included in reference image list 0 and a second reference image included in reference image list 1, the prediction encoder 3110 may reconstruct the current block by performing a weighted sum of a first prediction sample obtained from the first reference image and a second prediction sample obtained from the second reference image. In this case, the weights to be applied to the first prediction sample and the second prediction sample may be determined in advance, and the sum of the weight to be applied to the first prediction sample and the weight to be applied to the second prediction sample may be constant.
[0397] The prediction encoder 3110 may change the weights to be applied to the first prediction sample and the second prediction sample according to the result of the size comparison between the first reference image and the second reference image.
[0398] For example, when the size of the first reference image is equal to or greater than the size of the current image 2100 and the size of the second reference image is less than the size of the current image 2100, the prediction encoder 3110 may increase the weight to be applied to the first prediction sample and may decrease the weight to be applied to the second prediction sample.
[0399] In another example, when the size of the first reference image is less than the size of the current image 2100 and the size of the second reference image is greater than or equal to the size of the current image 2100, the prediction encoder 3110 may decrease the weight to be applied to the first prediction sample and may increase the weight to be applied to the second prediction sample.
[0400] In another example, when the size of the first reference image is the same as the size of the current image 2100 and the size of the second reference image is different from the size of the current image 2100, the prediction encoder 3110 may increase the weight to be applied to the first prediction sample and may decrease the weight to be applied to the second prediction sample.
[0401] In another embodiment, when the prediction mode of the current block is the affine skip mode or the affine merge mode, the prediction encoder 3110 may unidirectionally predict the current block by using the first reference image included in reference image list 0 or the second reference image included in reference image list 1. When it is determined that the prediction direction of the current block is bi - directional, the prediction encoder 3110 may select any one of the first reference image included in reference image list 0 and the second reference image included in reference image list 1, and may unidirectionally predict the current block by using the selected one reference image.
[0402] Specifically, when the prediction direction of the current block is bi - directional, the prediction encoder 3110 may unidirectionally predict the current block by using the reference image among the first reference image and the second reference image that has the same size as the current image 2100. When both the first reference image and the second reference image have sizes different from that of the current image 2100, the prediction encoder 3110 may unidirectionally predict the current block by using the reference image among the two reference images that has a size larger than the current image 2100; or when both reference images have sizes larger than the current image 2100, the prediction encoder 3110 may unidirectionally predict the current block by using the reference image among the two reference images that is closer in size to the current image 2100.
[0403] When the prediction direction of the current block is unidirectional and the size of the reference image of the current block is smaller than the size of the current image 2100, the prediction encoder 3110 may unidirectionally predict the current block by using an image among the images included in the reference image list that has a size equal to or larger than the current image 2100 (instead of using the reference image of the current block) as the reference image.
[0404] The prediction encoder 3110 obtains a motion vector of the current block that indicates prediction samples obtained from the reference image. To obtain the motion vector, the prediction decoder 2030 may configure a candidate list including motion vectors of adjacent blocks related to the current block as candidate motion vectors.
[0405] Adjacent blocks may include spatial domain blocks adjacent to the current block in the current image 2100 and temporal domain blocks located in a collocated image selected from among the images included in the reference image list.
[0406] As Figure 22 shown, adjacent blocks of the current block may include spatial domain blocks A0, A1, B0, B1, and B2 adjacent to the current block spatially and temporal domain blocks Col and Br adjacent to the current block temporally.
[0407] The prediction encoder 3110 may determine the availability of adjacent blocks in a specific order and may sequentially include the motion vectors of adjacent blocks in the candidate list as candidate motion vectors.
[0408] When an adjacent block is intra - frame predicted, the prediction encoder 3110 may determine that the adjacent block is unavailable.
[0409] In an embodiment, when an image having the same size as the current image 2100 does not exist in the images included in the reference image list, the prediction decoder 3110 may determine that the temporal block is unavailable. In this case, the motion vector of the temporal block is not included in the candidate list. On the contrary, when an image having the same size as the current image 2100 exists in the images included in the reference image list, the motion vector of the block in the collocated image may be included in the candidate list as a candidate motion vector.
[0410] In another embodiment, when a previous image having the same size as the current image 2100 does not exist in the previous images stored in the decoded picture buffer (DPB), the prediction decoder 3110 may determine that the temporal block is unavailable and may not include the motion vector of the temporal block in the candidate list. On the contrary, when a previous image having the same size as the current image 2100 exists in the previous images stored in the DPB, the prediction decoder 3110 may include the motion vector of the block in the collocated image in the candidate list as a candidate motion vector.
[0411] When the motion vectors of adjacent blocks are included in the candidate list, the prediction decoder 3110 may determine the order in which the motion vectors are included in the candidate list based on the size of the reference image indicated by the motion vectors of the adjacent blocks. For example, a low index (i.e., high priority) may be assigned to an adjacent block having a motion vector indicating a reference image of the same size as the current image 2100, and a high index (i.e., low priority) may be assigned to an adjacent block having a motion vector indicating a reference image smaller than the current image 2100. In another example, the lowest index (i.e., the highest priority) may be assigned to an adjacent block having a motion vector indicating a reference image of the same size as the current image 2100, a middle index (i.e., medium priority) may be assigned to an adjacent block having a motion vector indicating a reference image larger than the current image 2100, and the highest index (i.e., the lowest priority) may be assigned to an adjacent block having a motion vector indicating a reference image smaller than the current image 2100. When the number of adjacent blocks each having a motion vector indicating a reference image larger (or smaller) than the current image 2100 is two or more, a lower index may be assigned to the motion vector indicating a reference image closer to the size of the current image 2100.
[0412] The prediction encoder 3110 may generate information indicating a candidate motion vector among the candidate motion vectors included in the candidate list that is used as the motion vector of the current block. In an embodiment, the prediction encoder 3110 may generate information indicating a differential motion vector. The differential motion vector corresponds to the difference between the motion vector of the current block and the candidate motion vector.
[0413] In an embodiment, the information indicating the differential motion vector may include information indicating a change distance and information indicating a change direction. In this case, the image decoding apparatus 2000 may obtain the motion vector of the current block by changing the candidate motion vector selected in the candidate list according to the change distance and the change direction.
[0414] The information indicating the change distance may include an index, and the change distance corresponding to each index value may be predetermined. For example, an index of 0 may indicate a change distance of 1, an index of 1 may indicate a change distance of 2, and an index of 2 may indicate a change distance of 4.
[0415] The prediction decoder 3110 may scale the change distance corresponding to the index value by considering the size of the current image 2100. For example, when the size of the current image 2100 is equal to or greater than a preset size, the prediction decoder 3110 may increase the change distance corresponding to each index. In another example, when the height of the current image 2100 is equal to or greater than a preset value and the width of the current image 2100 is less than the preset value, the prediction decoder 3110 may increase the change distance corresponding to each index when the change direction is the height direction, and may maintain the change distance corresponding to each index when the change direction is the width direction.
[0416] When the residual data between the current sample and the predicted sample of the current block is obtained, a transformer (not shown) may change the residual data from the spatial domain to the frequency domain. In this case, the transformer may perform an inverse transform on the residual data by using a transform method selected from various transform methods based on the size of the current image 2100. The transform method may include, but is not limited to, a multi-transform selection (MTS) method of adaptively selecting one transform kernel from various transform kernels (e.g., DCT type 2, DST type 7, and DCT type 8), a non-separable second-order transform (NSST) method of performing a transform and then selectively performing a transform on low-frequency components, a rotation transform (ROT) method, a discrete sine transform (DST) method, and a discrete cosine transform (DCT) method.
[0417] The generator 3130 generates a bitstream as a result of encoding the image. The bitstream may include syntax elements, and according to the hierarchical structure of the image, the binary values corresponding to the syntax elements may be included in the bitstream. The generator 3130 may generate a bitstream including binary values by performing entropy encoding on the syntax elements.
[0418] The bitstream may include size information of the image to be decoded, information indicating the prediction mode of the blocks included in the image, information indicating the motion vectors of the blocks predicted by inter-frame prediction, and information indicating the residual data between the predicted samples and the original samples.
[0419] The size information of an image may be included in at least one of a sequence parameter set, a picture parameter set, and a video parameter set of a bitstream. In an embodiment, the size information of the image may include a temporal ID of the image.
[0420] Figure 32 is a flowchart for describing an image encoding method according to an embodiment.
[0421] In operation S3210, an image encoding apparatus 3100 compares the size of a current image 2100 including a current block with the size of a reference image. The image encoding apparatus 3100 may derive a ratio between the size of the current image 2100 and the size of the reference image as a result of the size comparison.
[0422] The image encoding apparatus 3100 may configure a reference image list including images decoded before the current image 2100, and may select a reference image of the current block from among the images included in the reference image list.
[0423] In operation S3220, the image encoding apparatus 3100 selects a reference sample corresponding to the current block in the reference image. When the size of the reference image is larger than the size of the current image 2100, the reference sample may be spaced apart by an interval corresponding to a result of the size comparison between the current image 2100 and the reference image in the reference image.
[0424] has been referred to Figure 24 and Figure 25 a method of selecting a reference sample by considering a ratio between the size of the current image 2100 and the size of the reference image has been described, and thus a detailed description thereof will be omitted.
[0425] The image encoding apparatus 3100 may generate a filtered sample by interpolating the reference sample, and may generate a prediction sample of the current block by using the filtered sample. Filter coefficients for interpolating the reference sample may be selected according to a comparison result between the size of the current image 2100 and the size of the reference image.
[0426] In operation S3230, an image decoding apparatus 2000 encodes a motion vector of the current block indicating the reference sample.
[0427] To encode the motion vector, the image encoding apparatus 3100 may configure a candidate list including motion vectors of adjacent blocks related to the current block as candidate motion vectors. The adjacent blocks may include a spatial domain block adjacent to the current block in the current image 2100 and a temporal domain block located in a collocated image selected from among the images included in the reference image list.
[0428] In an embodiment, when an image having the same size as the current image 2100 does not exist in the images included in the reference image list, the image encoding device 3100 may determine that the temporal block is unavailable. In this case, the motion vector of the temporal block is not included in the candidate list. On the contrary, when an image having the same size as the current image 2100 exists in the images included in the reference image list, the motion vectors of the blocks in the collocated image may be included in the candidate list as candidate motion vectors.
[0429] In another embodiment, when a previous image having the same size as the current image does not exist in the previous images stored in the decoded picture buffer (DPB), the image encoding device 3100 may determine that the temporal block is unavailable and may not include the motion vector of the temporal block in the candidate list. On the contrary, when a previous image having the same size as the current image 2100 exists in the previous images stored in the DPB, the image encoding device 3100 may include the motion vectors of the blocks in the collocated image in the candidate list as candidate motion vectors.
[0430] The image encoding device 3100 generates a bitstream including information on the size of the image, information indicating the prediction mode of the blocks included in the image, information indicating the motion vectors of the blocks predicted by inter-frame prediction, and information indicating the residual data between the predicted samples and the original samples.
[0431] According to the prediction mode, information indicating the differential motion vector, which is the difference between the motion vector of the current block and the candidate motion vectors, may be included in the bitstream.
[0432] Meanwhile, embodiments of the present disclosure may be written as programs executable on a computer, and these programs may be stored in a medium.
[0433] The medium may continuously store computer-executable programs, or may temporarily store computer-executable programs for execution or downloading. In addition, the medium may be any of various recording media or storage media in which single or multiple pieces of hardware are combined, and the medium is not limited to those directly connected to a specific computer system, but may be distributed over a network. Examples of the medium include magnetic media (e.g., hard disks, floppy disks, and magnetic tapes), optical recording media (e.g., compact disc-read only memory (CD-ROM) and digital versatile disc (DVD)), magneto-optical media (e.g., floppy disks), read-only memory (ROM), random access memory (RAM), flash memory, etc., which are configured to store program instructions. In addition, other examples of the medium may include recording media and storage media managed by an application store that distributes applications or by websites, servers, etc. that provide or distribute various other types of software.
[0434] So far, although the technical idea of the present disclosure has been described based on preferred embodiments, the technical idea of the present disclosure is not limited to the above embodiments, and those of ordinary skill in the art can make various modifications and changes within the scope of the technical idea of the present disclosure.
Claims
1. An image decoding method for decoding a video signal, the image decoding method comprising: Obtaining a value of a current block based on the size of a current picture and the size of a reference picture of the current block; Determining a motion vector of the current block; Determining a plurality of pixel positions within the reference picture by using the motion vector and the position of the top-left pixel in the current block; Selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, wherein the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; Generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions within the reference picture; and Reconstructing the current block by using the prediction value.
2. An image decoding apparatus for decoding a video signal, the image decoding apparatus comprising: A prediction decoder configured to: Obtain a value of a current block based on the size of a current picture and the size of a reference picture of the current block; Determine a motion vector of the current block; Determine a plurality of pixel positions within the reference picture by using the motion vector and the position of the top-left pixel in the current block; Select a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, wherein the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; Generate a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions within the reference picture; and Reconstruct the current block by using the prediction value.
3. An image encoding method for encoding a video signal, the image encoding method comprising: Obtaining a value of a current block based on the size of a current picture and the size of a reference picture of the current block; Determining a motion vector of the current block; Determining a plurality of pixel positions within the reference picture by using the motion vector and the position of the top-left pixel in the current block; Selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, wherein the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; Generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions within the reference picture; and Encoding the current block by using the prediction value.
4. A non-transitory computer-readable storage medium storing a bitstream, the bitstream being encoded by an encoding method comprising: Obtaining a value of a current block based on the size of a current picture and the size of a reference picture of the current block; Determining a motion vector of the current block; Determining a plurality of pixel positions within the reference picture by using the motion vector and the position of the top-left pixel in the current block; Selecting a filter coefficient set from a plurality of filter coefficient sets based on whether the value is greater than a predetermined value, wherein the filter coefficient set includes a plurality of filter coefficients for fractional positions of pixels; Generating a prediction value by using the selected filter coefficient set and reference samples corresponding to the plurality of pixel positions within the reference picture; and Encoding the current block by using the prediction value.