Image encoding / decoding method and recording medium storing bit stream
By using the reconstructed luminance block to predict chrominance blocks in image signal encoding/decoding, and optimizing prediction parameters based on linearity and sub-block similarity, the problem of insufficient prediction efficiency and accuracy in the prior art is solved, and a more efficient encoding and decoding process is achieved.
Patent Information
- Application Number
- CN202380065968.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-09-13
- Filing Date
- 2023-09-15
- Publication Date
- 2025-04-22
AI Technical Summary
During the image signal encoding/decoding process, it is difficult for the prior art to effectively predict chromaticity blocks, resulting in low encoding/decoding efficiency and intra prediction accuracy.
The chromaticity block is predicted using the reconstructed luminance block and predicted based on the linearity of the luminance component and the chromaticity component, the prediction is performed in units of sub-blocks, and the filter parameters are determined using the similarity between sub-blocks.
Improves encoding/decoding efficiency and intra prediction accuracy, and enhances the compression capability of high-resolution and ultra-high-resolution stereo image content.
Smart Images

Figure CN119866637A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to methods and apparatus for processing video signals. Background Art
[0002] Recently, the demand for high-resolution and high-quality images such as HD (high-definition) images and UHD (ultra-high-definition) images has increased in various application fields. Since the amount of data relatively increases compared with existing image data as image data becomes high-resolution and high-quality, when image data is transmitted by using a medium such as an existing wired and wireless broadband circuit or when image data is stored by using an existing storage medium, transmission costs and storage costs increase. These problems generated as image data becomes high-resolution and high-quality can be solved by using efficient image compression technology.
[0003] There are various technologies, such as inter-frame prediction technology that uses image compression technology to predict pixel values included in a current picture based on previous or subsequent pictures of the current picture, intra-frame prediction technology that predicts pixel values included in a current picture by using pixel information in the current picture, entropy coding technology that assigns short symbols to values with high occurrence frequencies and assigns long symbols to values with low occurrence frequencies, etc., and image data can be effectively compressed and transmitted or stored by using these image compression technologies.
[0004] On the other hand, as the demand for high-resolution images increases, the demand for stereoscopic image content as a new image service also increases. Video compression technology for efficiently providing high-resolution and ultra-high-resolution stereoscopic image content has been discussed. Summary of the invention
[0005] Technical issues
[0006] The present disclosure is to provide a method and apparatus for predicting a chrominance block by using a reconstructed luminance block when encoding / decoding an image signal.
[0007] The present disclosure is to provide a method and apparatus for predicting a chrominance block based on the linearity of a luminance component and a chrominance component when encoding / decoding an image signal.
[0008] The present disclosure is to provide a method and apparatus for predicting a chrominance block in units of sub-blocks when encoding / decoding an image signal.
[0009] The present disclosure is to provide a method and apparatus for deriving filter parameters for chroma block prediction by using similarity between sub-blocks when encoding / decoding an image signal.
[0010] The technical effects of the present disclosure may not be limited to the above-mentioned technical effects, and ordinary technicians in the technical field to which the present disclosure belongs may clearly understand other unmentioned technical effects from the following description.
[0011] Technical Solutions
[0012] The image encoding / decoding method according to the present disclosure includes: deriving filter coefficients for prediction of a chrominance block; and deriving prediction samples for the chrominance block by filtering a plurality of luminance reconstructed samples in a luminance block corresponding to the chrominance block based on the filter coefficients.
[0013] In the image decoding / encoding method according to the present disclosure, the shape of the filter applied to the luma reconstruction sample is determined based on at least one of the shape or size or color format of the current block, and the current block may be a chroma block or a luma block.
[0014] In the image decoding / encoding method according to the present disclosure, a filter is determined as one of a plurality of filter candidates, and the plurality of filter candidates may include a first filter candidate in a square shape and a second filter candidate in a non-square shape.
[0015] In the image decoding / encoding method according to the present disclosure, filter coefficients may be derived based on reconstructed samples included in a luma reference region around a luma block and reconstructed samples included in a chroma reference region around a chroma block.
[0016] In the image decoding / encoding method according to the present disclosure, filter coefficients may be derived based on feature values of reconstructed samples included in a luminance reference region.
[0017] In the image decoding / encoding method according to the present disclosure, the feature value may be a gradient value obtained by applying a mask to a reconstructed sample included in a luminance reference region.
[0018] In the image decoding / encoding method according to the present disclosure, the mask is one of a plurality of mask candidates, and selection of the mask among the plurality of mask candidates may be determined based on at least one of a color format or a filter shape.
[0019] In the image decoding / encoding method according to the present disclosure, prediction for a chroma block may be performed in units of sub-blocks.
[0020] In the image decoding / encoding method according to the present disclosure, a category index may be assigned to a luminance subblock corresponding to a chrominance subblock in a chrominance block, and a filter coefficient may be derived based on a reference subblock assigned with the same category index as that assigned to the luminance subblock within a reference area around the luminance block.
[0021] In the image decoding / encoding method according to the present disclosure, the class index assigned to the luma subblock may be derived based on at least one of the first cross-directional gradient or the second cross-directional gradient for the reconstructed samples within the luma subblock.
[0022] In the image decoding / encoding method according to the present disclosure, when a reference subblock assigned with the same class index as that assigned to the luma subblock does not exist within a reference area around the luma block, the filter coefficient may be set to a default value.
[0023] In the image decoding / encoding method according to the contents of the present disclosure, when there is no reference subblock assigned a category index identical to that assigned to a luminance subblock within a reference area around a luminance block, a filter coefficient can be derived by using a reference subblock assigned a category index assigned to the luminance subblock and a category index having a minimum difference.
[0024] In the image decoding / encoding method according to the present disclosure, whether to perform prediction in units of subblocks may be determined based on a flag parsed from a bitstream.
[0025] A computer-readable recording medium storing a bit stream encoded by the image encoding method according to the present disclosure may be provided.
[0026] Technical Effects
[0027] According to the present disclosure, encoding / decoding efficiency may be improved by predicting a chrominance block by using a reconstructed luminance block.
[0028] According to the present disclosure, the accuracy of intra prediction can be improved by predicting a chrominance block based on the linearity of a luminance component and a chrominance component.
[0029] According to the present disclosure, the accuracy of intra prediction can be improved by predicting a chroma block in units of sub-blocks.
[0030] According to the present disclosure, the accuracy of intra prediction can be improved by using the similarity between sub-blocks to derive filter parameters for chroma block prediction.
[0031] Effects obtainable from the present disclosure are not limited to the above-mentioned effects, and other unmentioned effects may be clearly understood from the following description by a person of ordinary skill in the technical field to which the present disclosure pertains. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
[0033] Figure 2is a block diagram showing an image decoding apparatus according to an embodiment of the present disclosure.
[0034] Figure 3 An image encoding / decoding method performed by the image encoding / decoding device according to the present disclosure is shown.
[0035] Figure 4 and Figure 5 Examples of multiple intra prediction modes according to the present disclosure are shown.
[0036] Figure 6 A planar mode based intra prediction method according to the present disclosure is shown.
[0037] Figure 7 A DC mode based intra prediction method according to the present disclosure is shown.
[0038] Figure 8 A directional mode based intra prediction method according to the present disclosure is shown.
[0039] Fig. 9 A method for deriving samples at fractional positions is shown.
[0040] Fig.10 and Fig.11 It is shown that the tangent value of the angle is scaled by a factor of 32 in intra prediction mode.
[0041] Fig.12 is a diagram showing aspects of intra prediction when the directional mode is one of mode number 34 to mode number 49.
[0042] Fig.13 is a diagram for describing an example of generating top reference samples by interpolating left reference samples.
[0043] Fig.14 An example of performing intra prediction by using reference samples arranged in a 1D array is shown.
[0044] Fig.15 is a flow chart illustrating a method for predicting a chrominance block by using a reconstructed luma block.
[0045] Figures 16 to 18 An example of downsampling a luma block is shown.
[0046] Fig.19 is a diagram for describing an example regarding a location where downsampling is applied.
[0047] Fig. 20 An example of obtaining predicted samples of a chroma block by applying a 9-tap filter to a luma block is shown.
[0048] Fig.21 The reference region used to derive the filter coefficients is shown.
[0049] Fig. 22 and Fig.23 The mask used to derive the gradient values is shown.
[0050] Fig.24 An example in which prediction is performed in units of sub-blocks is shown.
[0051] Fig.25 An example of deriving gradients for sub-blocks is shown.
[0052] Fig.26 An example for describing a sample for calculating a gradient is shown. DETAILED DESCRIPTION
[0053] Since the present disclosure can be varied and has several embodiments, specific embodiments will be illustrated in the drawings and described in detail. However, it is not intended to limit the present disclosure to specific embodiments, and it should be understood that the present disclosure includes all changes, equivalents or substitutes included in the concept and technical scope of the present disclosure. When describing each of the drawings, similar reference numerals are used for similar parts.
[0054] Terms such as first, second, etc. may be used to describe various components, but components should not be limited by these terms. These terms are only used to distinguish one component from other components. For example, without exceeding the scope of the rights of the present disclosure, a first component may be referred to as a second component, and similarly, a second component may also be referred to as a first component. The term and / or includes a combination of multiple related input items or any item in multiple related input items.
[0055] When a component is referred to as being "linked" or "connected" to another component, it should be understood that the component may be directly linked or connected to the other component, but other components may exist in between. On the other hand, when a component is referred to as being "directly linked" or "directly connected" to another component, it should be understood that other components do not exist in between.
[0056] Because the terms used in this application are only used to describe specific embodiments, they are not intended to limit the present disclosure. Singular expressions include plural expressions unless they clearly have different meanings in the context. In this application, it should be understood that terms such as "including" or "having" refer to the existence of characteristics, numbers, steps, movements, parts, parts or combinations thereof entered in the specification, but do not exclude the possibility of adding or existing in advance one or more other characteristics, numbers, steps, movements, parts, parts or combinations thereof.
[0057] Hereinafter, with reference to the accompanying drawings, a desired embodiment of the present disclosure will be described in more detail. Hereinafter, the same reference numerals are used for the same components in the drawings, and repeated description of the same components is omitted.
[0058] Figure 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
[0059] Reference Figure 1 The image encoding device (100) may include: a picture segmentation unit (110), a prediction unit (120, 125), a transformation unit (130), a quantization unit (135), a rearrangement unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse transformation unit (145), a filter unit (150) and a memory (155).
[0060] Although Figure 1 Each structural unit shown in is independently shown to represent different characteristic functions in the image encoding device, but this does not mean that each structural unit is composed of separate hardware or a software unit. That is, although each structural unit is included by being listed as each structural unit for the convenience of description, at least two structural units in each structural unit can be combined to constitute one structural unit, or one structural unit can be divided into multiple structural units to perform functions, and even the integrated implementation and separate implementation of each structural unit are included in the scope of the rights of the present disclosure as long as they do not depart from the essence of the present disclosure.
[0061] In addition, some components may be only optional components for improving performance, rather than essential components for performing the basic functions in the present disclosure. The present disclosure may be implemented by including only structural units necessary for realizing the essence of the present disclosure without including components only for improving performance, and a structure including only essential components without including optional components only for improving performance is also included in the scope of the rights of the present disclosure.
[0062] The picture segmentation unit (110) may segment an input picture into at least one processing unit. In this case, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). In the picture segmentation unit (110), a picture may be segmented into a combination of a plurality of coding units, prediction units, and transform units, and the picture may be encoded by selecting a combination of a coding unit, a prediction unit, and a transform unit according to a predetermined criterion (e.g., a cost function).
[0063] For example, a picture may be divided into a plurality of codec units. In order to divide the codec units in the picture, a recursive tree structure such as a quadtree may be used, and a codec unit divided into other codec units by using an image or a maximum coding unit as a root may be divided with as many child nodes as the number of divided codec units. A codec unit that is no longer divided according to a specific restriction becomes a leaf node. In other words, when it is assumed that only square division is possible for one codec unit, one codec unit may be divided into up to four other codec units.
[0064] Hereinafter, in the embodiments of the present disclosure, a codec unit may be used as a unit for encoding, or may be used as a unit for decoding.
[0065] The prediction unit may be partitioned into at least one square or rectangular shape, etc., of the same size in one coding unit, or may be partitioned such that any one of the prediction units partitioned in one coding unit may have a different shape and / or size from another prediction unit.
[0066] When a prediction unit for performing intra prediction based on a coding unit is generated and the prediction unit is not a minimum coding unit, the intra prediction may be performed without splitting the prediction unit into a plurality of prediction units N×N.
[0067] The prediction unit (120, 125) may include an inter-frame prediction unit (120) that performs inter-frame prediction and an intra-frame prediction unit (125) that performs intra-frame prediction. It may be determined whether to perform inter-frame prediction or intra-frame prediction on the encoding and decoding unit, and detailed information (e.g., intra-frame prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. In this case, the processing unit that performs the prediction may be different from the processing unit that determines the prediction method and details. For example, the prediction method, prediction mode, etc. may be determined in the prediction unit, and the prediction may be performed in the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform unit (130). In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy encoding unit (165) and may be sent to the decoding device. When a specific encoding mode is used, the original block may be encoded as is without generating a prediction block through the prediction unit (120, 125) and sent to the decoding unit.
[0068] The inter-frame prediction unit (120) may predict the prediction unit based on information about at least one picture in the previous picture or the subsequent picture of the current picture, or in some cases may predict the prediction unit based on information about some coding regions in the current picture. The inter-frame prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
[0069] The reference picture interpolation unit may receive reference picture information from a memory (155) and generate pixel information equal to or less than an integer pixel in the reference picture. For luma pixels, an 8-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information equal to or less than an integer pixel in units of 1 / 4 pixels. For chrominance signals, a 4-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information equal to or less than an integer pixel in units of 1 / 8 pixels.
[0070] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolation unit. Various methods such as FBMA (block matching algorithm based on full search), TSS (three-step search), NTS (new three-step search algorithm), etc. may be used as a method for calculating a motion vector. Based on the interpolated pixel, the motion vector may have a motion vector value in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit may predict the current prediction unit by changing the motion prediction method. As a motion prediction method, various methods such as a skip method, a merge method, an advanced motion vector prediction (AMVP) method, an intra-block copy method, etc. may be used.
[0071] The intra prediction unit (125) can generate a prediction unit based on reference pixel information around the current block, which is pixel information in the current picture. When the neighboring block in the current prediction unit is a block for performing inter-frame prediction and therefore the reference pixel is a pixel for performing inter-frame prediction, the reference pixel included in the block for performing inter-frame prediction can be used by replacing it with the reference pixel information of the surrounding blocks for performing intra-frame prediction. In other words, when the reference pixel is unavailable, the unavailable reference pixel information can be used by replacing it with at least one reference pixel among the available reference pixels.
[0072] The prediction mode of the intra prediction may have a directional prediction mode that uses reference pixel information according to a prediction direction when performing prediction and a non-directional mode that does not use directional information. The mode for predicting luminance information may be different from the mode for predicting chrominance information, and the intra prediction mode information for predicting luminance information or the predicted luminance signal information may be used to predict chrominance information.
[0073] When the size of the prediction unit is the same as the size of the transform unit when performing intra prediction, intra prediction for the prediction unit can be performed based on the pixel at the left position, the pixel at the upper left position, and the pixel at the top position of the prediction unit. However, if the size of the prediction unit is different from the size of the transform unit when performing intra prediction, intra prediction can be performed by using reference pixels based on the transform unit. In addition, intra prediction using N×N partitioning can be used only for the minimum decoding unit.
[0074] The intra prediction method may generate a prediction block after applying an adaptive intra smoothing (AIS) filter to reference pixels according to a prediction mode. The type of AIS filter applied to the reference pixels may be different. In order to perform the intra prediction method, the intra prediction mode in the current prediction unit may be predicted based on the intra prediction modes in the prediction units surrounding the current prediction unit. When predicting the prediction mode in the current prediction unit by using the mode information predicted according to the surrounding prediction units, if the intra prediction mode in the current prediction unit is the same as the intra prediction mode in the surrounding prediction units, information that the prediction mode in the current prediction unit is the same as the prediction mode in the surrounding prediction units may be sent by using predetermined flag information, and if the prediction mode in the current prediction unit is different from the prediction mode in the surrounding prediction units, the prediction mode information of the current block may be encoded by performing entropy coding.
[0075] In addition, a residual block including information on a residual value that is a difference value between a prediction unit predicted based on the prediction unit generated in the prediction unit (120, 125) and an original block in the prediction unit may be generated. The generated residual block may be input to the transform unit (130).
[0076] The transform unit (130) can transform the original block and the residual block described below by using a transform method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), KLT, and the residual block includes residual value information in the prediction unit generated by the prediction unit (120, 125). Whether to apply DCT, DST or KLT to transform the residual block can be determined based on intra-frame prediction mode information in the prediction unit used to generate the residual block.
[0077] The quantization unit (135) may quantize the value transformed to the frequency domain in the transform unit (130). The quantization coefficient may be changed according to the importance of the block or image. The value calculated in the quantization unit (135) may be provided to the inverse quantization unit (140) and the rearrangement unit (160).
[0078] The rearrangement unit (160) may perform rearrangement of coefficient values on the quantized residual value.
[0079] The rearrangement unit (160) can change the coefficients in the shape of a two-dimensional block into the shape of a one-dimensional vector by a coefficient scanning method. For example, the rearrangement unit (160) can scan the DC coefficient to the coefficient in the high frequency domain by using a zigzag scanning method, and change it into the shape of a one-dimensional vector. Depending on the size of the transform unit and the intra-frame prediction mode, instead of the zigzag scanning, vertical scanning that scans the coefficients in the shape of a two-dimensional block in the column direction or horizontal scanning that scans the coefficients in the shape of a two-dimensional block in the row direction can be used. In other words, it can be determined which scanning method to use among the zigzag scanning, the vertical direction scanning, and the horizontal direction scanning according to the size of the transform unit and the intra-frame prediction mode.
[0080] The entropy coding unit (165) may perform entropy coding based on the value calculated by the rearrangement unit (160). For example, the entropy coding may use various coding methods such as Exponential Golomb, CAVLC (Context Adaptive Variable Length Coding), and CABAC (Context Adaptive Binary Arithmetic Coding).
[0081] The entropy coding unit (165) can encode various information from the rearrangement unit (160) and the prediction unit (120, 125), such as residual value coefficient information and block type information in the coding unit, prediction mode information, partition unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, filtering information, etc.
[0082] The entropy encoding unit (165) may perform entropy encoding on the coefficient values in the codec unit input from the rearrangement unit (160).
[0083] The inverse quantization unit (140) and the inverse transform unit (145) inversely quantize the value quantized in the quantization unit (135) and inversely transform the value transformed in the transform unit (130). The residual value generated by the inverse quantization unit (140) and the inverse transform unit (145) can be combined with the prediction unit predicted by the motion prediction unit, the motion compensation unit, and the intra-frame prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.
[0084] The filter unit (150) may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0085] The deblocking filter can remove block distortion generated by the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels included in several rows or columns included in the block. When the deblocking filter is applied to the block, a strong filter or a weak filter can be applied according to the required deblocking filter strength. In addition, in the case of applying the deblocking filter, when horizontal filtering and vertical filtering are performed, horizontal direction filtering and vertical direction filtering can be set to parallel processing.
[0086] The offset correction unit can correct the offset from the original image in units of pixels for the image on which deblocking is performed. In order to perform offset correction on a specific picture, the area where the offset is to be performed can be determined after dividing the pixels included in the image into a certain number of areas, and a method of applying the offset to the corresponding area or a method of applying the offset by considering edge information of each pixel can be used.
[0087] Adaptive loop filtering (ALF) may be performed based on a value obtained by comparing a filtered reconstructed image with an original image. After the pixels included in the image are divided into predetermined groups, filtering may be performed differently by group by determining a filter to be applied to the corresponding group. Information on whether ALF is applied may be transmitted per codec unit (CU) for a luminance signal, and the shape and filter coefficient of the ALF filter to be applied may vary for each block. In addition, an ALF filter having the same shape (fixed shape) may be applied regardless of the characteristics of the block to be applied.
[0088] The memory (155) may store the reconstructed block or picture calculated by the filter unit (150), and when inter-frame prediction is performed, the stored reconstructed block or picture may be provided to the prediction unit (120, 125).
[0089] Figure 2 is a block diagram showing an image decoding apparatus according to an embodiment of the present disclosure.
[0090] Reference Figure 2 , the image decoding device (200) may include: an entropy decoding unit (210), a rearrangement unit (215), an inverse quantization unit (220), an inverse transform unit (225), a prediction unit (230, 235), a filter unit (240) and a memory (245).
[0091] When an image bitstream is input from the image encoding device, the input bitstream may be decoded according to a process reverse to that of the image encoding device.
[0092] The entropy decoding unit (210) can perform entropy decoding according to a process opposite to the process of performing entropy encoding in the entropy encoding unit of the image encoding device. For example, various methods such as Exponential Golomb, CAVLC (Context Adaptive Variable Length Coding) and CABAC (Context Adaptive Binary Arithmetic Coding) can be applied in response to the method performed in the image encoding device.
[0093] The entropy decoding unit (210) can decode information related to intra-frame prediction and inter-frame prediction performed in the encoding device.
[0094] The rearrangement unit (215) may perform rearrangement based on a method of rearranging the bit stream entropy decoded in the entropy decoding unit (210) in the coding unit. The coefficients expressed in the form of a one-dimensional vector may be rearranged by reconstructing the coefficients in the form of a two-dimensional block. The rearrangement unit (215) may receive information related to coefficient scanning performed in the coding unit, and perform rearrangement by a method of performing scanning inversely based on a scanning order performed in the corresponding coding unit.
[0095] The inverse quantization unit (220) may perform inverse quantization based on the quantization parameter provided from the encoding device and the coefficient value of the rearranged block.
[0096] The inverse transform unit (225) can perform the transform performed in the transform unit, that is, the inverse transform for DCT, DST and KLT (that is, inverse DCT, inverse DST and inverse KLT) on the result of the quantization performed in the image encoding device. The inverse transform can be performed based on the transmission unit determined in the image encoding device. In the inverse transform unit (225) of the image decoding device, the transform technology (e.g., DCT, DST, KLT) can be selectively performed according to a plurality of information such as a prediction method, a size of a current block, a prediction mode, etc.
[0097] The prediction unit (230, 235) may generate a prediction block based on information related to generation of the prediction block provided from the entropy decoding unit (210) and pre-decoded block or picture information provided from the memory (245).
[0098] As described above, when the size of the prediction unit is the same as the size of the transform unit when performing intra prediction in the same manner as the operation in the image encoding device, intra prediction of the prediction unit can be performed based on the pixel at the left position, the pixel at the upper left position, and the pixel at the top position of the prediction unit, but when the size of the prediction unit is different from the size of the transform unit when performing intra prediction, intra prediction can be performed by using reference pixels based on the transform unit. In addition, intra prediction using N×N partitioning can be used only for the minimum decoding unit.
[0099] The prediction unit (230, 235) may include a prediction unit determination unit, an inter-frame prediction unit, and an intra-frame prediction unit. The prediction unit determination unit may receive various information input from the entropy decoding unit (210), such as prediction unit information, prediction mode information of an intra-frame prediction method, information related to motion prediction of an inter-frame prediction method, etc., divide the prediction unit in the current coding unit, and determine whether the prediction unit performs inter-frame prediction or intra-frame prediction. The inter-frame prediction unit (230) may perform inter-frame prediction on the current prediction unit based on information included in at least one of a previous picture or a subsequent picture of a current picture including the current prediction unit, by using information required for inter-frame prediction in the current prediction unit provided from the image encoding device. Alternatively, inter-frame prediction may be performed based on information about some areas pre-reconstructed in the current picture including the current prediction unit.
[0100] In order to perform inter prediction, whether a motion prediction method in a prediction unit included in a corresponding codec unit is a skip mode, a merge mode, an AMVP mode, or an intra block copy mode may be determined based on the codec unit.
[0101] The intra prediction unit (235) can generate a prediction block based on pixel information in the current picture. When the prediction unit is a prediction unit that performs intra prediction, intra prediction can be performed based on intra prediction mode information in the prediction unit provided from the image encoding device. The intra prediction unit (235) may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. As a part of performing filtering on the reference pixels of the current block, the AIS filter can be applied by determining whether to apply the filter according to the prediction mode in the current prediction unit. AIS filtering can be performed on the reference pixels of the current block by using the prediction mode and AIS filter information in the prediction unit provided from the image encoding device. When the prediction mode of the current block is a mode in which AIS filtering is not performed, the AIS filter may not be applied.
[0102] When the prediction mode in the prediction unit is a prediction unit that performs intra-frame prediction based on a pixel value interpolated from a reference pixel, the reference pixel interpolation unit may interpolate the reference pixel so as to generate the reference pixel in units of pixels equal to or less than an integer value. When the prediction mode in the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. When the prediction mode of the current block is a DC mode, the DC filter may generate a prediction block by filtering.
[0103] The reconstructed block or picture may be provided to a filter unit (240). The filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF.
[0104] Information about whether a deblocking filter is applied to a corresponding block or picture and information about whether a strong filter or a weak filter is applied when the deblocking filter is applied may be provided from the image encoding device. Information related to the deblocking filter provided from the image encoding device may be provided in the deblocking filter of the image decoding device, and deblocking filtering of the corresponding block may be performed in the image decoding device.
[0105] The offset correction unit may perform offset correction on the reconstructed image based on offset value information applied to the image when encoding is performed, the type of offset correction, and the like.
[0106] ALF may be applied to the codec unit based on information on whether ALF is applied, ALF coefficient information, etc. provided from the encoding device. Such ALF information may be provided by being included in a specific parameter set.
[0107] The memory (245) may store the reconstructed picture or block to be used as a reference picture or a reference block, and provide the reconstructed picture to the output unit.
[0108] As described above, hereinafter, in the embodiments of the present disclosure, for convenience of description, a codec unit is used as a term of a codec unit, but it may be a unit that performs decoding as well as encoding.
[0109] In addition, since the current block represents a block to be encoded / decoded, it may represent a codec tree block (or codec tree unit), a codec block (or codec unit), a transform block (or transform unit), or a prediction block (or prediction unit), etc., depending on the encoding / decoding step. In the present specification, a "unit" may represent a basic unit for performing a specific encoding / decoding process, and a "block" may represent a pixel array of a predetermined size. Unless otherwise classified, "block" and "unit" may be used interchangeably. For example, in the embodiments described later, it may be understood that a codec block (codec block) and a codec unit (codec unit) may be used interchangeably.
[0110] Figure 3 An image encoding / decoding method performed by the image encoding / decoding device according to the present disclosure is shown.
[0111] Reference Figure 3 , a reference line for intra prediction of a current block may be determined ( S300 ).
[0112] The current block may use one or more of a plurality of reference line candidates predefined in an image encoding / decoding device as a reference line for intra prediction. Here, the plurality of predefined reference line candidates may include adjacent reference lines adjacent to the current block to be decoded and N non-adjacent reference lines that are 1 sample to N samples away from the boundary of the current block. N may be an integer of 1, 2, 3 or a greater value. In the following, for ease of description, it is assumed that the plurality of reference line candidates available for the current block include adjacent reference line candidates and three non-adjacent reference line candidates, but is not limited thereto. In other words, the plurality of reference line candidates available for the current block may of course include four or more non-adjacent reference line candidates.
[0113] The image encoding device may determine the best reference line candidate among multiple reference line candidates and encode an index for specifying the best reference line candidate. The image decoding device may determine the reference line of the current block based on the index signaled by the bitstream. The index may specify any one of the multiple reference line candidates. The reference line candidate specified by the index may be used as the reference line of the current block.
[0114] The number of indexes signaled to determine the reference line of the current block may be 1, 2, or more. For example, when the number of indexes signaled above is 1, the current block may perform intra-frame prediction by using only a single reference line candidate specified by the signaled index among the multiple reference line candidates. Alternatively, when the number of indexes signaled above is at least 2, the current block may perform intra-frame prediction by using multiple reference line candidates specified by multiple indexes among the multiple reference line candidates.
[0115] Reference Figure 3 , the intra prediction mode of the current block can be determined (S310).
[0116] The intra prediction mode of the current block can be determined from a plurality of intra prediction modes predefined in the image encoding / decoding device. Figure 4 and Figure 5 To describe multiple predefined intra prediction modes.
[0117] Figure 4 Examples of multiple intra prediction modes according to the present disclosure are shown.
[0118] Reference Figure 4 , the plurality of intra prediction modes predefined in the image encoding / decoding device may include a non-directional mode and a directional mode. The non-directional mode may include at least one of a planar mode or a DC mode. The directional mode may include directional modes 2 to 66.
[0119] Directional mode can be compared Figure 4 The directional pattern shown is much more extended. Figure 5An example in which the directional mode is extended is shown.
[0120] exist Figure 5 , adding mode -1 to mode -14 and mode 67 to mode 80 are shown. These directional modes may be referred to as wide-angle intra prediction modes. Whether to use the wide-angle intra prediction mode may be determined based on the shape of the current block. For example, if the current block is a non-square block with a width greater than a height, some directional modes (e.g., numbers 2 to 15) may be transformed into wide-angle intra prediction modes between numbers 67 and 80. On the other hand, if the current block is a non-square block with a height greater than a width, some directional modes (e.g., numbers 53 to 66) may be transformed into wide-angle intra prediction modes between numbers 1 and -14.
[0121] The range of available wide-angle intra prediction modes may be adaptively determined according to the ratio of the width to the height of the current block. Table 1 shows the range of available wide-angle intra prediction modes according to the ratio of the width to the height of the current block.
[0122] [Table 1]
[0123] Width / Height Available wide-angle intra prediction mode range W / H=16 67~80 W / H=8 67~78 W / H=4 67~76 W / H=2 67~74 W / H=1 none W / H=1 / 2 -1~-8 W / H=1 / 4 -1~-10 W / H=1 / 8 -1~-12 W / H=1 / 16 -1~-14
[0124] Among multiple intra prediction modes, K candidate modes (most probable modes, MPMs) may be selected. A candidate list including the selected candidate modes may be generated. An index indicating any one of the candidate modes belonging to the candidate list may be signaled. The intra prediction mode of the current block may be determined based on the candidate mode indicated by the index. For example, the candidate mode indicated by the index may be configured as the intra prediction mode of the current block. Alternatively, the intra prediction mode of the current block may be determined based on the value of the candidate mode indicated by the index and a predetermined difference. The difference may be defined as the difference between the value of the intra prediction mode of the current block and the value of the candidate mode indicated by the index. The difference may be signaled by a bitstream. Alternatively, the difference may be a value predefined in an image encoding / decoding device. Alternatively, the intra prediction mode of the current block may be determined based on a flag indicating whether there is a mode identical to the intra prediction mode of the current block in the candidate list. For example, when the flag is a first value, the intra prediction mode of the current block may be determined from the candidate list. In this case, an index indicating any one of the multiple candidate modes belonging to the candidate list may be signaled. The candidate mode indicated by the index can be configured as the intra-frame prediction mode of the current block. On the other hand, when the flag is the second value, any one of the remaining intra-frame prediction modes can be configured as the intra-frame prediction mode of the current block. The remaining intra-frame prediction modes may refer to a mode of multiple predefined intra-frame prediction modes excluding the candidate modes belonging to the candidate list. When the flag is the second value, an index indicating any one of the remaining intra-frame prediction modes can be signaled. The intra-frame prediction mode indicated by the signaled index can be configured as the intra-frame prediction mode of the current block. The intra-frame prediction mode of a chroma block can be selected from the intra-frame prediction mode candidates of multiple chroma blocks. To this end, index information indicating one of the intra-frame prediction mode candidates of the chroma block can be explicitly encoded and signaled by the bitstream. Table 2 shows the intra-frame prediction mode candidates for the chroma block.
[0125] [Table 2]
[0126]
[0127] In the example of Table 2, direct mode (DM) refers to setting the intra-frame prediction mode of the luminance block present at the same position as the chrominance block to the intra-frame prediction mode of the chrominance block. At the same time, the luminance block present at the same position as the chrominance block can be determined based on the position of the upper left sample or the position of the center sample of the chrominance block. For example, if the intra-frame prediction mode (luminance mode) of the luminance block is number 0 (planar mode) and the index indicates number 2, the intra-frame prediction mode of the chrominance block can be determined as the horizontal mode (number 18). For example, if the intra-frame prediction mode (luminance mode) of the luminance block is number 1 (DC mode) and the index indicates number 0, the intra-frame prediction mode of the chrominance block can be determined as the plane mode (number 0).
[0128] Therefore, the intra prediction mode of the chroma block can also be set to Figure 4 or Figure 5 One of the intra prediction modes shown. The intra prediction mode of the current block may be used to determine the reference line of the current block, and in this case, S310 may be performed before S300.
[0129] Reference Figure 3 , intra prediction may be performed on the current block based on the intra prediction mode and the reference line of the current block (S320).
[0130] In the following, by reference Figures 6 to 8 The intra prediction method by intra prediction mode is described in detail. However, for ease of description, it is assumed that intra prediction for the current block uses a single reference line, but even when multiple reference lines are used, the intra prediction method described later can be applied in the same / similar manner.
[0131] Figure 6 A planar mode based intra prediction method according to the present disclosure is shown.
[0132] Reference Figure 6 , T represents a reference sample located at the upper right corner of the current block, and L represents a reference sample located at the lower left corner of the current block. P1 may be generated by interpolation in the horizontal direction. For example, P1 may be generated by interpolating T and a reference sample located on the same horizontal line as P1. P2 may be generated by interpolation in the vertical direction. For example, P2 may be generated by interpolating L and a reference sample located on the same vertical line as P2. As shown in the following equation 3, the current sample in the current block may be predicted by the weighted sum of P1 and P2.
[0133] [Formula 1]
[0134] (α×P1+β×P2) / (α+β)
[0135] In Formula 1, weights α and β can be determined by considering the width and height of the current block. Depending on the width and height of the current block, weights α and weights β may have the same value or different values. If the width and height of the current block are the same, weights α and β may be configured to be the same, and the predicted sample of the current sample may be configured as the average of P1 and P2. When the width and height of the current block are different, weights α and β may have different values. For example, when the width is greater than the height, a smaller value may be configured as a weight corresponding to the width of the current block, and a larger value may be configured as a weight corresponding to the height of the current block. Conversely, when the width is greater than the height, a larger value may be configured as a weight corresponding to the width of the current block, and a smaller value may be configured as a weight corresponding to the height of the current block. Here, the weight corresponding to the width of the current block may refer to β, and the weight corresponding to the height of the current block may refer to α.
[0136] Figure 7 A DC mode based intra prediction method according to the present disclosure is shown.
[0137] Reference Figure 7 , the average value of the surrounding samples adjacent to the current block can be calculated, and the calculated average value can be configured as the prediction value of all samples in the current block. Here, the surrounding samples may include the top reference sample and the left reference sample of the current block. However, depending on the shape of the current block, the average value may be calculated by using only the top reference sample or the left reference sample. For example, when the width of the current block is greater than the height, the average value may be calculated by using only the top reference sample of the current block. Alternatively, when the ratio of the width to the height of the current block is greater than or equal to a predetermined threshold, the average value may be calculated by using only the top reference sample of the current block. Alternatively, when the ratio of the width to the height of the current block is less than or equal to a predetermined threshold, the average value may be calculated by using only the top reference sample of the current block. On the other hand, when the width of the current block is less than the height, the average value may be calculated by using only the left reference sample of the current block. Alternatively, when the ratio of the width to the height of the current block is less than or equal to a predetermined threshold, the average value may be calculated by using only the left reference sample of the current block. Alternatively, when the ratio of the width to the height of the current block is greater than or equal to a predetermined threshold, the average value may be calculated by using only left reference samples of the current block.
[0138] Figure 8 A directional mode based intra prediction method according to the present disclosure is shown.
[0139] When the intra-frame prediction mode of the current block is a directional mode, the reference line can be projected according to the angle of the corresponding directional mode. When there is a reference sample at the projection position, the corresponding reference sample can be configured as a prediction sample of the current sample. If there is no reference sample at the projection position, the sample corresponding to the projection position can be generated by using one or more surrounding samples adjacent to the projection position. For example, interpolation can be performed based on two or more surrounding samples adjacent to the projection position in both directions to generate a sample corresponding to the projection position. Alternatively, a surrounding sample adjacent to the projection position can be configured as a sample corresponding to the projection position. In this case, among the multiple surrounding samples adjacent to the projection position, the surrounding sample closest to the projection position can be used. The sample corresponding to the projection position can be configured as a prediction sample of the current sample.
[0140] Reference Figure 8 , for the current sample B, when the reference line is projected at the corresponding position according to the angle of the intra prediction mode, there is a reference sample at the projection position (i.e., the reference sample R3 at the integer position). In this case, the reference sample at the projection position can be configured as the prediction sample of the current sample B. For the current sample A, when the reference line is projected at the corresponding position according to the angle of the intra prediction mode, there is no reference sample at the projection position (i.e., the reference sample at the integer position). In this case, interpolation can be performed based on surrounding samples (e.g., R2 and R3) adjacent to the projection position to generate a sample (r) at a fractional position. The generated sample (r) at the fractional position can be configured as the prediction sample of the current sample A.
[0141] Fig. 9 A method for deriving samples at fractional positions is shown.
[0142] exist Fig. 9 In the example of , the variable h refers to the vertical distance (i.e., vertical distance) from the position of the prediction sample A to the reference sample line, and the variable w refers to the horizontal distance (i.e., horizontal distance) from the position of the prediction sample A to the fractional position sample. In addition, the variable θ refers to an angle predefined according to the directionality of the intra prediction mode, and the variable x refers to the fractional position.
[0143] The variable w can be obtained as shown in Equation 2 below.
[0144] [Formula 2]
[0145] w=htanθ
[0146] Then, if we remove the integer positions from the variable w, we can finally get the fractional positions.
[0147] The fractional position samples may be generated by interpolating adjacent integer position reference samples. For example, the fractional position reference samples at the x position may be generated by interpolating integer position reference samples R2 and integer position reference samples R3.
[0148] When deriving fractional position samples, a scaling factor can be used to avoid real number operations. For example, when the scaling factor f is set to 32, as Figure 8 In the example shown in (b), the distance between adjacent integer reference samples can be set to 32 instead of 1.
[0149] Furthermore, the tangent value of the angle θ determined according to the directionality of the intra prediction mode may also be scaled by using the same scaling factor (eg, 32).
[0150] Fig.10 and Fig.11 It is shown that the tangent value of the angle is scaled by a factor of 32 in intra prediction mode.
[0151] Fig.10 shows the scaling results of the tangent value for non-wide angle intra prediction mode, and Fig.11 The scaling results of the tangent values for the wide angle intra prediction mode are shown.
[0152] If the tangent value (tanθ) of the angle value used for the intra prediction mode is positive, intra prediction can be performed by using only one of the reference samples belonging to the top line of the current block (i.e., top reference samples) or the reference samples belonging to the left line of the current block (i.e., left reference samples). Meanwhile, when the tangent value of the angle value used for the intra prediction mode is negative, both the reference samples at the top position and the reference samples at the left position are used.
[0153] In this case, to simplify the implementation, the left reference samples may be projected to the top, or may be projected to the left to arrange the reference samples in a 1D array form, and intra prediction may be performed using the reference samples in the 1D array form.
[0154] Fig.12 is a diagram showing aspects of intra prediction when the directional mode is one of mode number 34 to mode number 49.
[0155] When the intra prediction mode of the current block is one of mode number 34 to mode number 49, intra prediction is performed by using not only the top reference sample of the current block but also the left reference sample. Fig.12 In the example shown, the reference samples of the top line may be generated by copying the reference samples at the left position of the current block to the position of the top line or by interpolating the reference samples at the left position.
[0156] For example, when a reference sample of position A on the top of the current block is obtained, projection may be performed on the left line of the current block at position A on the top line, taking into account the directionality of the intra-prediction mode of the current block. If the projection position is referred to as a, the value corresponding to position a may be copied, or a fractional position value corresponding to position a may be generated and set to the value of position A. For example, if position a is an integer position, the value of position A may be generated by copying the integer position reference sample. On the other hand, when position a is a fractional position, the reference sample at the top position of position a and the reference sample at the bottom position of position a may be interpolated, and the interpolated value may be set to the value of position A. At the same time, at position A on the top of the current block, the direction of the projection to the left line of the current block may be parallel to and opposite to the direction of the intra-prediction mode of the current block.
[0157] Fig.13 is a diagram for describing an example of generating top reference samples by interpolating left reference samples.
[0158] exist Fig.13 , variable h represents the horizontal distance between position A on the top line and position a on the left line. Variable w represents the vertical distance between position A on the top line and position a on the left line. In addition, variable θ refers to an angle predefined according to the directionality of the intra prediction mode, and variable x refers to a fractional position.
[0159] The variable h can be obtained as shown in Equation 3 below.
[0160] [Formula 3]
[0161] h=w / tanθ
[0162] Afterwards, if the integer positions are removed from the variable h, the fractional positions can be finally obtained.
[0163] When deriving fractional position samples, scaling factors can be used to avoid real number operations. For example, the tangent of the variable θ can be scaled by using a scaling factor f1. Here, since the direction of the projection to the left line is parallel and opposite to the directional prediction mode, Fig.10 and Fig.11 Scaled tangent values shown.
[0164] When the scaling factor f1 is applied, Equation 3 may be modified and used as in Equation 4 below.
[0165] [Formula 4]
[0166] h=(w*f1*f2)*(f1*tanθ)
[0167] In the same manner as described above, a 1D reference sample array may be configured with only reference samples belonging to the top line. Thus, intra prediction of the current block may be performed by using only the top reference samples comprising the 1D array.
[0168] Fig.14 An example of performing intra prediction by using reference samples arranged in a 1D array is shown.
[0169] like Fig.14 In the example shown, the left reference samples may be projected to generate the top reference samples, and thus, the prediction samples of the current block may be obtained by using only the reference samples belonging to the top line.
[0170] and Fig.12 and Fig.14 In contrast to what is shown in , the top reference sample can be projected to the left line to configure the 1D reference sample array using only the reference samples belonging to the left line. Specifically, for pattern numbers 19 to 33 of the directional patterns in which the tangent value (tanθ) of the angle of the directional pattern is negative, the reference samples belonging to the top line can be projected to the left line to generate the left reference samples.
[0171] The reconstructed luma block can be used to perform prediction on the chroma block. As described above, the prediction model using different color components can be called a cross component linear model (CCLM). When CCLM is applied, the process of deriving the intra prediction mode of the chroma block based on the intra prediction mode of the luma block can be omitted.
[0172] Fig.15 is a flow chart illustrating a method for predicting a chrominance block by using a reconstructed luma block.
[0173] Reference Fig.15 First, for the prediction of the chroma block, a prediction parameter may be derived (S1510). In this case, the prediction parameter may be derived in different ways according to the image format of the picture. Since the image format indicates the chroma subsampling rate, it may be determined as one of 4:4:4, 4:2:2, or 4:2:0.
[0174] When the image format is not 4:4:4, the luma blocks are downsampled and resized to have the same size as the chroma blocks.
[0175] Figures 16 to 18 An example of downsampling a luma block is shown.
[0176] For ease of description, it is assumed that the image format is 4:2:0.
[0177] When the image format is 4:2:0, such as Fig.16In the example shown, the size of the chrominance block corresponding to the 4×4 sized luma block is 2×2. In this case, a downsampling filter may be applied to the luma block to reduce the 4×4 sized luma block to a size of 2×2. The following equation 5 shows aspects of the application of the downsampling filter.
[0178] [Formula 5]
[0179] Downsampled_Luma[w][h]=(Luma[2*w][2*h-1]+Luma[2*w-1][2*h]+4*Luma[2*w][2*h]+Luma[2*w+1][2*h]+Luma[2*w][2*h+1]+4)>>3
[0180] In Formula 5, Downsampled_Luma refers to the sample value in the downsampled luma block, and Luma refers to the value of the luma sample before downsampling. For example, Luma[0][0] may represent the position of the upper left sample in the luma block before downsampling. Since the size of the downsampled luma block is 2×2, the variables w and h representing the coordinates of the sample may have values from 0 to 1, respectively.
[0181] When the down-sampling filter according to Formula 5 is applied, the value of the down-sampled luma sample can be obtained by applying the cross-shaped down-sampling filter to the luma sample. For example, the value of the down-sampled luma sample at the position of (0, 0) can be obtained by applying the down-sampling filter to the luma sample at the position of (0, 0), the top luma sample at the position of (0, 0), the left luma sample at the position of (0, 0), the bottom luma sample at the position of (0, 0), and the right luma sample at the position of (0, 0).
[0182] You can also apply Fig.17 The downsampling filters may be shaped differently than those shown in FIG. For example, a 1D filter, a rectangular filter, or a square filter may be applied to obtain downsampled luminance samples. The 1D filter may have a size of 1×3 or 3×1, the rectangular filter may have a size of 2×3 or 3×2, and the square filter may have a size of 2×2 or 3×2.
[0183] The filter shapes can be predefined in the encoder and decoder.
[0184] Alternatively, the shape of the filter may be adaptively determined based on at least one of the size / shape of the current block, the intra prediction mode applied to the luma block, whether the positions of the chroma samples match those of the luma samples, or the image format.
[0185] Alternatively, information indicating one of a plurality of filter candidates may be encoded and signaled.
[0186] Alternatively, the filter type may be different according to the downsampling position. For example, a 1D filter or a rectangular filter may be applied to luma samples located at the boundary of a luma block, while a cross filter may be applied to luma samples not located at the boundary of a luma block.
[0187] like Fig.17 As shown, the downsampling filter can be applied to positions where both the x-axis coordinate and the y-axis coordinate are even numbers.
[0188] Can be used with Fig.17 The application positions shown in set the application positions of the downsampling filters differently. Fig.18 Various examples of where the downsampling filter may be applied are shown.
[0189] After predefining a plurality of candidates related to the downsampling application position, one of the plurality of candidates may be selected. Fig.18 After the examples of (a) to (d) in FIG. 1 are defined as a plurality of candidates, index information indicating one of the plurality of examples may be encoded and signaled.
[0190] Alternatively, one of the multiple candidates may be selected based on whether the position of the chroma samples matches the position of the luma samples.
[0191] The downsampling filter may also be applied to reference samples around the luma block. Here, the reference samples may represent pre-reconstructed samples. Specifically, the downsampled luma reference samples may be obtained by applying the downsampling filter to at least one of a top reference region adjacent to the top of the luma block or a left reference region adjacent to the left.
[0192] The same number of down-sampled luma reference samples as the number of reference samples included in the reference region of the chroma block may be obtained.
[0193] Meanwhile, the reference region of the luma block may be referred to as a luma reference region, and the reference region of the chroma block may be referred to as a chroma reference region.
[0194] The inter-component prediction mode may be divided into a top inter-component prediction mode, a left inter-component prediction mode, and a top and left inter-component prediction mode according to the configuration of the reference region. When the top inter-component prediction mode is selected, the reference region of each of the luminance block and the chrominance block includes only the top reference region. When the left inter-component prediction mode is selected, the reference region of each of the luminance block and the chrominance block includes only the left reference region. When the top and left inter-component prediction mode is selected, the reference region of each of the luminance block and the chrominance block may include the top reference region and the left reference region.
[0195] Information indicating which of the top inter-component prediction mode, the left inter-component prediction mode, and the top and left inter-component prediction mode is applied to the current block may be explicitly encoded and signaled. For example, index information indicating the type of the inter-component prediction mode may be encoded and signaled.
[0196] Alternatively, one of the top component inter prediction mode, the left component inter prediction mode, and the top and left component inter prediction mode may be selected based on at least one of the size / shape of the current block, whether the current block is adjacent to a CTU or picture boundary, or an intra prediction mode applied to a luma block.
[0197] For convenience of description, in the embodiments described below, it is assumed that a reference region of each of a luminance block and a chrominance block includes a top reference region and a left reference region.
[0198] The shape of the down-sampling filter applied to the reference area of the luminance block may be the same as the down-sampling filter applied to the luminance block. Alternatively, the shape of the down-sampling filter applied to the reference area of the luminance block may be different from the down-sampling filter applied to the luminance block. Alternatively, the shape of the down-sampling filter applied to the top reference area of the luminance block may be different from the shape of the down-sampling filter applied to the left reference area of the luminance block.
[0199] Meanwhile, the positions where downsampling is applied within the reference region may be predefined in the encoder and the decoder.
[0200] As another example, the decoder may itself determine where within the reference region to apply downsampling in the same manner as the encoder.
[0201] Fig.19 is a diagram for describing an example regarding a location where downsampling is applied.
[0202] When the image format is 4:2:0, a chrominance block of size 1×1 corresponds to a luma block of size 2×2. Therefore, a downsampled luma reference sample corresponding to the chrominance reference sample can be obtained by applying a downsampling filter to the position of one of the four luma reference samples.
[0203] When four luma reference samples corresponding to one chroma reference sample are A to D, downsampling may be performed on each of positions A to D in the reference area, and the cost of each position may be calculated. Here, the cost of a specific position may be derived based on the sum of the differences between the downsampled luma reference sample obtained by applying a downsampling filter centered on the corresponding position and the chroma reference sample corresponding to the corresponding position, or the sum of the absolute values of the differences. Therefore, the cost derived based on the sum of the absolute values of the differences may also be referred to as SAD (Sum of Differences).
[0204] Thereafter, the position having the lowest cost may be determined as the optimal position, and the process of deriving prediction parameters described below may be performed by using the downsampled luma samples at the optimal position.
[0205] Alternatively, information indicating one of a plurality of positions where the downsampling filter may be applied may be encoded and signaled. Fig.19 In the example shown, an index indicating one of positions A to D may be encoded and signaled. To this end, the encoder may obtain a prediction parameter for each of a plurality of positions to which a downsampling filter may be applied, and may encode and signal an index indicating a position for deriving an optimal prediction parameter among the plurality of prediction parameters. Here, the optimal prediction parameter may be derived by cost or rate-distortion optimization (RDO) of each prediction parameter.
[0206] Meanwhile, determining the best downsampling application position in the top reference region can be independent of determining the best downsampling application position in the left reference region. In this case, the best downsampling application position in the top reference region can be different from the best downsampling application position in the left reference region.
[0207] The prediction parameters for the chroma block may be derived by using the reference samples of the chroma block and the downsampled luma reference samples. The prediction parameters may include a weight α and an offset β. The prediction parameters may be derived by using a least square method or the like.
[0208] Alternatively, the weight α and the offset β may be derived based on the linearity of the maximum and minimum values of the downsampled luma reference samples and the maximum and minimum values of the chroma reference samples.
[0209] In this case, the prediction parameters can also be derived by using only the chroma reference samples at the predefined positions and the downsampled luma reference samples corresponding to the chroma reference samples. In this case, the process of deriving the prediction parameters can be simplified to reduce the complexity of the encoder and decoder. For example, the prediction parameters can be derived by using the chroma reference samples at the positions shown in the following equation 6.
[0210] [Formula 6]
[0211] (-1, W / 4), (-1, 3W / 4), (H / 4, -1), (3H / 4, -1)
[0212] In this example, W and H represent the width and height of the chroma block, respectively. The prediction parameters may be derived by using four chroma reference samples according to the example and four down-sampled luma reference samples corresponding thereto.
[0213] The prediction parameter may also be obtained by using a reference sample at a position different from the position of this example. For example, the position of the reference sample may be determined as in the following equations 7 and 8.
[0214] [Formula 7]
[0215] (-1, W / 4), (-1, 3W / 4), (-1, 5W / 4), (-1, 7W / 4)
[0216] [Formula 8]
[0217] (H / 4,-1), (3H / 4,-1), (5H / 4,-1), (7H / 4,-1)
[0218] After predefining multiple candidates for the position of the reference sample, one of the multiple candidates may be selected. For example, after setting each example in Equations 6 to 8 listed above as a position candidate, the reference sample may be selected according to one of the multiple position candidates.
[0219] Information for selecting one of the plurality of candidate positions may be encoded and signaled. For example, an index indicating one of the plurality of position candidates may be encoded and signaled.
[0220] Alternatively, one of the plurality of position candidates may be adaptively selected based on at least one of the size / shape of the current block, the color format, or whether the position of the chroma sample matches the position of the luma sample.
[0221] For example, when the current block is a square, the prediction parameter may be derived by using the position candidate in Equation 6. On the other hand, when the current block is a non-square, the prediction parameter may be derived by using the position candidate in Equation 7 or Equation 8. For example, when the current block has a non-square shape with a width greater than a height, the position candidate in Equation 7 may be used, and when the current block has a non-square shape with a height greater than a width, the position candidate in Equation 8 may be used.
[0222] Once the prediction parameters are obtained, the prediction samples of the chrominance block can be obtained based on the downsampled luma samples (S1520). For example, the prediction samples of the chrominance block can be obtained according to the following equation 9.
[0223] [Formula 9]
[0224] PredChroma[w][h]=α×Downsampled_luma[w][h]+β,
[0225] 0≤w<W,0≤h<H
[0226] In Equation 9, PredChroma represents a prediction sample of a chroma block, and Downsampled_Luma represents a downsampled luma sample at a position corresponding to the chroma prediction sample.
[0227] Meanwhile, when the image format is 4:4:4, the above-mentioned downsampling process can be omitted. In other words, when the image format is 4:4:4, the process of downsampling the reconstructed samples in the luminance block and the process of downsampling the reference samples of the luminance block can be omitted.
[0228] As another example, regardless of the image format, the downsampling filter may not be applied to the reference area of the luma block. In other words, when deriving prediction parameters, instead of using the minimum and maximum values among the downsampled luma reference samples, the minimum and maximum values among the luma reference samples may be used.
[0229] The prediction samples for the chroma prediction block may be derived by using a filter including more filter coefficients than those in Equation 9.
[0230] Fig. 20 An example of deriving prediction samples for a chroma block by applying a 9-tap filter to a luma block is shown.
[0231] exist Fig. 20 In the example, it is assumed that a square filter of size 3×3 is applied to the luma block. In this case, the predicted sample output by the filter can be obtained as shown in Equation 10 below.
[0232] [Formula 10]
[0233]
[0234] In Equation 10, (x, y) represents the position of the prediction sample to be generated, and (i, j) represents the position of the filter coefficient. In addition, W and H represent the horizontal length and the vertical length of the filter, respectively.
[0235] Meanwhile, in Formula 10, when the value of H / 2 or W / 2 is a real number rather than an integer, it is processed into an integer by a lowering operation. Fig. 20 In the example shown, when a filter of size 3×3 is applied, the values of W and H are 3, respectively. In this case, the values of W / 2 and H / 2 are 1.5 instead of integers. Through the reduction operation, the values of H / 2 and W / 2 can be processed to 1. Similarly, through the reduction operation, -1.5 can be processed to -1.
[0236] In Equation 10, I refers to an input value. Here, the input value may be a reconstructed sample in a downsampled luma block that exists at the same position as a sample to be predicted in a chroma block.
[0237] In Equation 10, O refers to the output value, specifically, the value of the predicted sample in the chrominance block.
[0238] At the same time, Fig. 20 In the figure, it is assumed that the filter shape is a square shape of 3×3 size. However, a filter of a shape different from the shape shown can be used to obtain the prediction samples of the chrominance block. For example, the prediction samples for the chrominance block can be obtained by using a cross filter with the same width and height or a square filter with different widths and heights (such as a square filter of 3×2 size or a square filter of 2×3 size, etc.). At the same time, when a cross filter is applied, the maximum width and maximum height of the filter can be set to 3, 4, or 5, etc.
[0239] In Equation 10, f(i, j) represents a filter coefficient. The filter coefficient may be derived by using a pre-reconstruction region adjacent to a chrominance block and a pre-reconstruction region adjacent to a luminance block. Here, the pre-reconstruction region may refer to a reference region.
[0240] Fig.21 The reference region used to derive the filter coefficients is shown.
[0241] Depending on the color attribute, the current block may represent a luminance block or a chrominance block.
[0242] As in Fig.21 In the example shown in , the reference region may include a top reference region adjacent to the top of the current block and a left reference region adjacent to the left of the current block.
[0243] Alternatively, with Fig.21 Unlike the example shown in , the filter coefficients can be derived by using only the top reference region or only the current left reference region.
[0244] In order to obtain the filter coefficients, the resolution of the luma reference region may be adjusted to be the same as that of the chroma reference region. Specifically, downsampling of the luma reference region may be performed to adjust the size of the luma reference region to be the same as that of the chroma reference region.
[0245] Meanwhile, when the chroma format is 4:4:4, the above-mentioned resolution adjustment process may be omitted.
[0246] Afterwards, the filter coefficients can be derived by using the reconstructed samples (or downsampled reconstructed samples) in the luma reference region with the adjusted resolution and the reconstructed samples in the chroma reference region. Specifically, based on equations 11 and 12, the filter coefficients that minimize the difference between the reconstructed samples in the luma reference region and the reconstructed samples in the chroma reference region can be derived.
[0247] [Formula 11]
[0248]
[0249] [Formula 12]
[0250]
[0251] In the above formula 11, S refers to the luma reference region and the chroma reference region with adjusted resolution. C(x, y) represents the chroma reference sample in the chroma reference region. L(x, y) represents the luma reference sample (or downsampled luma reference sample) in the luma reference region.
[0252] Regression analysis can be used to derive filter coefficients based on equations 11 and 12. For example, a least mean square method can be used.
[0253] Meanwhile, instead of using the reconstructed samples in the reference region, the filter coefficients may be derived by using the feature values derived based on the reconstructed samples. For example, the filter coefficients may be derived by using at least one of the gradient values derived based on the reconstructed samples belonging to the luminance reference region or the gradient values derived based on the reconstructed samples belonging to the chrominance reference region.
[0254] For example, the filter coefficients may be derived to ensure that the difference between the characteristic value of each reconstructed sample in the reference region of the luminance block and the characteristic value of each reconstructed sample in the reference region of the chrominance block is minimized. For example, Equation 12 may be changed to the following Equation 13 to derive the variable L'(x, y), and the variable L'(x, y) may be input into Equation 11 to derive the filter coefficients.
[0255] [Formula 13]
[0256]
[0257] In the above formula 13, G(x, y) represents the gradient value at the position (x, y) in the brightness reference area.
[0258] Meanwhile, even when deriving prediction samples for chrominance blocks, the gradient of luma reconstruction samples may be input instead of luma reconstruction samples. For example, equation 10 may be changed to equation 14 below to obtain chrominance prediction samples.
[0259] [Formula 14]
[0260]
[0261] The gradient value may be derived by applying a mask to the reconstructed sample and reconstructed samples surrounding the reconstructed sample.
[0262] Fig. 22 and Fig.23 The mask used to derive the gradient values is shown.
[0263] Fig. 22 A non-square mask is shown, and Fig.23 A square mask is shown.
[0264] You can Fig. 22 or Fig.23 At least one of the masks shown in is applied to the reconstructed sample and reconstructed samples around the reconstructed sample to obtain a gradient value of the reconstructed sample.
[0265] For example, based on Fig. 22 or Fig.23 At least one of the masks shown in the convolution is performed on the reconstructed samples in the luma reference region whose resolution is adjusted to be the same as that of the chroma reference region to obtain the gradient value of the reconstructed samples.
[0266] Meanwhile, masks for deriving gradient values may be predefined in the encoder and decoder.
[0267] Alternatively, the mask used to derive the gradient value among the plurality of masks may be adaptively determined according to the color format or the filter shape. For example, when a 3×3 shaped filter is applied to derive the chrominance prediction sample, Fig.23 On the other hand, when applying a 3×2 shaped filter to obtain the chrominance prediction samples, one can use Fig. 22 The gradient value is derived using one of the non-square masks shown in .
[0268] Alternatively, a mask for deriving a gradient value among a plurality of masks may be adaptively determined according to the position of the brightness reconstruction sample. For example, when the reference sample is included in the left reference region, a non-square mask of 2×3 size may be applied. On the other hand, when the reference sample is included in the top reference region, a non-square mask of 3×2 size may be applied.
[0269] Alternatively, an index indicating a mask applied to the current block among a plurality of masks may be explicitly encoded and signaled.
[0270] As another example, after applying multiple masks, the gradient of the brightness reconstruction sample can be found by an average or weighted sum operation for the output values of each of the multiple masks.
[0271] For example, for a brightness reconstruction sample at a position of (x, y), a first mask consisting of [{1, 0, -1}, {1, 0, -1}] and a second mask consisting of [{1, 1, 1}, {-1, -1, -1}] may be applied. Afterwards, a result of an average operation or a weighted sum operation between a first result value output by the first mask and a second result value output by the second mask may be set as a gradient value of the brightness reconstruction sample.
[0272] Thereafter, a prediction block for the chroma block may be obtained by using the derived filter coefficients.
[0273] Meanwhile, in Equation 10, it is shown that in order to obtain one output value, that is, one chroma prediction sample, a plurality of input values, that is, a plurality of luma reconstruction samples are each input once. In other words, it is shown that in order to obtain a chroma prediction sample at the position (x, y), a filter is used in which a luma reconstruction sample at the position (x, y) and reconstruction samples around the luma reconstruction sample are each input once.
[0274] As another example, in order to provide high correlation to the input value at a specific position, a filter may be applied to ensure that the input value at the specific position is input multiple times. For example, Equation 10 may be changed to the following Equation 15 to obtain prediction samples for a chroma block.
[0275] [Formula 15]
[0276]
[0277] In this case, Equation 12 for deriving the filter coefficients may be changed as in Equation 16 below.
[0278] [Formula 16]
[0279]
[0280] In the above formula 15, C represents an offset. C may be an integer including 0. The offset may be predefined in the encoder and the decoder. Alternatively, the offset may be determined based on the bit depth. For example, the offset may be a middle value of a range that may be expressed by the bit depth.
[0281] N represents the number of input values with high priority. In other words, N represents the number of input values that are input multiple times. n are additional filter parameters, and x n and n is a variable used to determine the position given high priority.
[0282] For example, when the value of N is 1 and the values of x0 and y0 are respectively 0, it can be understood that a high priority is given to an input value at the same position as an output value, that is, a luma reconstructed sample at the same position as a chroma prediction sample.
[0283] N or (x can be predefined in the encoder and decoder n ,y n ). Alternatively, with respect to N or (x n ,y n ) may be explicitly encoded and signaled.
[0284] Alternatively, N or (x n ,y n ). For example, when the filter has a non-square shape of 3×2 size, N may be set to 2. On the other hand, when the filter has a square shape of 3×3 size, N may be set to 1.
[0285] After the current block is divided into a plurality of sub-blocks, prediction may be performed in units of sub-blocks. Here, the current block may represent a luminance block and a chrominance block according to a color component. For ease of description, a sub-block included in the current block may be referred to as a luminance sub-block and a chrominance sub-block according to a color component, and a sub-block included in a reference region may be referred to as a reference sub-block.
[0286] Specifically, the chrominance prediction sample for the sub-block in the current block can be obtained by using a filter coefficient obtained based on a reference sub-block having the same characteristics as the sub-block in the current block among a plurality of reference sub-blocks included in the reference region of the current block. To this end, a process of assigning one of a plurality of categories can be performed for each sub-block in the reference region and the current block.
[0287] Meanwhile, information indicating whether prediction is performed in units of sub-blocks may be encoded and signaled. For example, the information may be a 1-bit flag.
[0288] Whether prediction is allowed to be performed in units of sub-blocks may be determined according to the shape or size or color format of the current block. For example, prediction may be allowed to be performed in units of sub-blocks only when the size of the current block is greater than 8×8 or 16×16. A flag may be signaled only when prediction is allowed to be performed in units of sub-blocks.
[0289] Fig.24 An example in which prediction is performed in units of sub-blocks is shown.
[0290] The current block and the reference area of the current block may be partitioned into sub-blocks of a size of M×N.
[0291] In this case, the size of the sub-block may be predefined in the encoder and decoder. Alternatively, the size and / or shape of the sub-block may be adaptively determined according to the size and / or shape of the current block. Alternatively, information indicating the size of the sub-block may be encoded and signaled.
[0292] At the same time, the size / shape of the sub-block generated by dividing the current block and the size / shape of the sub-block generated by dividing the reference area can be set differently. For example, the current block can be divided into 4×4 sub-blocks, and the reference area can be divided into 8×8 sub-blocks.
[0293] For ease of description, in this example, it is assumed that the size of the sub-block for the luminance component is 4×4.
[0294] Afterwards, each subblock for the luminance component may be classified into one of a plurality of categories. Specifically, one of a plurality of categories may be assigned to each subblock within the luminance block and each subblock within the luminance reference region. Classification may be performed only for the subblocks of the luminance component.
[0295] The classification of the sub-block may be performed based on the sum of the reconstructed samples within the sub-block. For example, the category assigned to the sub-block may be determined by the examples in the following Equations 17 and 18.
[0296] [Formula 17]
[0297] ClassIdx=(sub_blk_sum*A)>>(bitDepth+log2(H×W))
[0298] [Formula 18]
[0299]
[0300] In Formula 17, ClassIdx refers to the index of the category assigned to the sub-block. H and W refer to the height and width of the sub-block, respectively. A refers to the total number of categories. For example, when A is 10, it means that the sub-block is classified into one of 10 categories. In other words, when A is 10, ClassIdx can be determined as one of 0 to 9.
[0301] The total number of categories may be predefined in the encoder and the decoder. Alternatively, information indicating the total number of categories may be explicitly encoded and signaled. At the same time, the information may be signaled through at least one of a video parameter set, a sequence parameter set, a picture parameter set, a picture header, or a slice header.
[0302] In Formula 18, sub_blk[w, h] refers to the sample value at the position [w, h] in the sub-block.
[0303] All samples in the sub-block may be combined to derive the variable sub_blk_sum, and based on the variable sum_blk_sum, the index classIdx of the class to be assigned to the sub-block may be determined.
[0304] As another example, the category assigned to the sub-block may be determined by using a gradient. Specifically, after calculating the gradient at each position within the sub-block, the sum of the gradients at each position may be set as the gradient of the sub-block. In this case, the gradient may include at least one of a horizontal gradient, a vertical gradient, an upper right diagonal gradient, or an upper left diagonal gradient.
[0305] A gradient in a specific direction can be derived based on neighboring samples placed along a specific direction from a gradient derived target sample. For example, a horizontal gradient can be derived by using the left neighboring samples and the right neighboring samples of the gradient derived target sample. A vertical gradient can be derived by using the top neighboring samples and the bottom neighboring samples of the gradient derived target sample. An upper right diagonal gradient can be derived by using the upper right neighboring samples and the lower left neighboring samples of the gradient derived target sample. An upper left diagonal gradient can be derived by using the upper left neighboring samples and the lower right neighboring samples of the gradient derived target sample.
[0306] Meanwhile, when a sample is located at a boundary of a sub-block, at least one neighboring sample for the corresponding sample is located outside the sub-block. In view of this, an extension region may be defined around the sub-block, and a gradient of each sample included in the sub-block may be derived by including the samples included in the extension region.
[0307] The extended region may be defined as a region including N lines adjacent to at least one of the left side, right side, top, or bottom of the sub-block. For example, when the size of the sub-block is 4×4 and the extended region consists of one line on each of the left side, right side, top, and bottom of the sub-block, the gradient of each sample in the sub-block may be derived by using samples included in a block of 6×6 size.
[0308] Alternatively, for at least one sample included in the extended region, a gradient may be derived. In this case, the gradient of the sub-block may be derived by adding the gradient of the sample within the sub-block and the gradient of the sample within the extended region.
[0309] The size of the extension area may be predefined in the encoder and decoder.
[0310] Alternatively, information indicating the size of the extension area may be encoded and signaled.
[0311] Alternatively, the size of the extended area may be adaptively determined based on at least one of the shape or size or color format of the current block.
[0312] Fig.25 An example of deriving gradients for sub-blocks is shown.
[0313] For ease of description, it is assumed that the size of the current block is 4 × 4. In addition, it is assumed that the gradient of the sub-block is calculated using an 8 × 8 size region by including the sub-block and the extended region, and it is assumed that the gradient of the sub-block is obtained by adding the gradient of each sample in the 6 × 6 size region.
[0314] exist Fig.25 In the example shown in , the gradient of the sub-block can be derived as in the examples of Equations 19 to 22.
[0315] [Formula 19]
[0316]
[0317] V k,l =|2R(k,l)-R(k,l-1)-R(k,l+1)|
[0318] [Formula 20]
[0319]
[0320] H k,l =|2R(k,l)-R(k-1,l)-R(k+1,l)|
[0321] [Formula 21]
[0322]
[0323] D1 k,l =|2R(k,l)-R(k-1,l-1)-R(k+1,l+1)|
[0324] [Formula 22]
[0325]
[0326] D2 k,l =|2R(k,l)-R(k-1,l+1)-R(k+1,l-1)|
[0327] In equations 19 to 22, (i, j) represents the position of the upper left sample in the 4×4 sub-block. R(k, l) represents the sample value at the position (k, l). |x| represents the absolute value of x.
[0328] V k,l represents the vertical gradient of the sample at the position (k, l), and g v Represents the vertical gradient of the sub-block.
[0329] H k,lrepresents the horizontal gradient of the sample at the position (k, l), and g h Represents the horizontal gradient of the sub-block.
[0330] D1 k,l represents the upper right diagonal gradient of the sample at the position (k, l), and g d1 Represents the upper right diagonal gradient of the sub-block.
[0331] D2 k,l represents the upper left diagonal gradient of the sample at the position (k, l), and g d2 Represents the upper left diagonal gradient of the sub-block.
[0332] The gradient of the sub-block can be used to determine the category of the sub-block. Specifically, one of the multiple categories can be assigned to the sub-block. For example, when the number of categories is 25, a category index indicating one of 0 to 24 can be assigned to the sub-block.
[0333] At the same time, the category assigned to the sub-block can be determined by comparing the values between the gradients. Specifically, the variables DirHV and / or DirD used to determine the category can be derived based on at least one of the maximum value, minimum value, median value or average value of the gradient.
[0334] Equation 23 shows an example of distinguishing the maximum value and the minimum value of the gradient in the vertical-horizontal direction (hereinafter, referred to as the first cross direction).
[0335] [Formula 23]
[0336]
[0337] The maximum and minimum values of the first cross direction can be compared to obtain the variable DirHV of the first cross direction of the sub-block. v Greater than g h When the value is 1, the variable DirHV is set to 1, otherwise, the variable DirHV is set to 3.
[0338] Next, as in the example of Equation 24, the maximum value and the minimum value of the gradient in the upper left diagonal line-upper right diagonal line direction (hereinafter, referred to as the second cross direction) can be distinguished.
[0339] [Equation 24]
[0340]
[0341] The maximum value and the minimum value of the second cross direction can be compared to obtain the variable DirD of the second cross direction of the sub-block. For example, when gd0 is greater than gd1, the variable DirD is set to 0, otherwise, the variable DirD is set to 2.
[0342] Afterwards, the direction with strong tendency can be determined by using the first cross-directional gradient and the second cross-directional gradient. Specifically, the maximum value among the second cross-directional gradients (i.e., g d0,d1 max ) and the minimum value among the first cross-directional gradients (i.e., g h,v min ) and the minimum value among the second cross-directional gradients (i.e., g d0,d1 min ) and the minimum value among the first cross-directional gradients (i.e., g h,v max ) are compared to determine the direction with a strong tendency.
[0343] Specifically, according to Formula 25 and Formula 26, the maximum and minimum values of the direction with a stronger tendency can be obtained.
[0344] [Formula 25]
[0345]
[0346] [Equation 26]
[0347]
[0348] hvd1 is a variable reflecting the maximum value of the gradient in the direction having a stronger tendency between the first and second intersecting directions, and hvd0 is a variable reflecting the minimum value of the gradient in the direction having a stronger tendency between the first and second intersecting directions.
[0349] Then, according to Equations 27 and 28, the index of the direction with a stronger tendency is set.
[0350] [Formula 27]
[0351]
[0352] [Equation 28]
[0353]
[0354] dir1 is a variable reflecting the value of the variable of the direction with the stronger tendency between the first cross direction and the second cross direction, and dir2 is a variable reflecting the value of the variable of the direction with the weaker tendency between the first cross direction and the second cross direction.
[0355] Thereafter, Equation 29 may be used to set the variable dirS according to the difference between the maximum value and the minimum value of the direction having a strong tendency between the first cross direction and the second cross direction.
[0356] [Formula 29]
[0357] dirS=(hvd1*2>9*hvd0)? 2: ((hvd1>2*hvd0)?1:0)
[0358] When the variable dirS is determined, the class index ClassIdx to be assigned to the subblock may be determined by using the following Equation 30. For example, when there are 25 classes in total, ClassIdx may be determined as a value of 0 to 24.
[0359] [Formula 30]
[0360] ClassIdx = (dirS = 0)? Q[g h +g v ]: (((dir1 0X1)<<1)+dirS)*5+Q[g h +g v ]
[0361] In the formula 30, Q[g h +g v ] indicates that by quantizing g h and g v When the number of categories is 25, Q[g h +g v ] can be set to a value from 0 to 4.
[0362] At the same time, in order to simplify the gradient calculation, the number of samples used to calculate the gradient of the sub-block can be reduced. Specifically, it can be set to reduce the size of the extended area or only use samples at the sub-sampling position, thereby simplifying the gradient calculation.
[0363] Fig.26 An example for describing a sample for calculating a gradient is shown.
[0364] Fig.26 An example is shown in which the reconstruction samples included in the sub-block and the reconstruction samples included in the extended region are used. In this case, in order to simplify the gradient calculation, as in Fig.26 In the example shown in (a), the gradient can be calculated by using only the reconstructed samples at the sub-sampling positions.
[0365] Alternatively, as in Fig.26 In the example shown in (b) of FIG. 5 , the category of the sub-block can be determined by using only the gradient of the samples included in the sub-block.
[0366] Alternatively, as in Fig.26 In the examples shown in (c) and (d) of FIG. 5 , the category of a sub-block can be determined by using only the gradients at the sub-sampling positions within the sub-block.
[0367] Meanwhile, when subsampling is applied, a subsampling method or a subsampling rate may be predefined in an encoder and a decoder.
[0368] Alternatively, information on at least one of whether subsampling is performed, a subsampling method, or a subsampling rate may be encoded and signaled.
[0369] Alternatively, whether to perform at least one of subsampling, a subsampling method, or a subsampling rate may be adaptively determined based on at least one of a shape or a size or a color format of the current block.
[0370] To simplify the category determination, the category can be determined by using only one of the first cross direction and the second cross direction. For example, the category can be determined by using only the gradients in the vertical direction and the horizontal direction, or the category can be determined by using only the gradients in the upper right diagonal direction and the upper left diagonal direction.
[0371] Meanwhile, based on at least one of the size or the shape of the current block, one of the first cross direction and the second cross direction may be selected.
[0372] Alternatively, at least one of the range of samples for deriving a category or the direction of the gradient for deriving a category may be independently determined for each unit region. Here, the unit region may refer to a region that can be processed in parallel with another region, and for example, the unit region may refer to a tile, a slice, or a sub-picture.
[0373] For example, when there are two blocks in a picture, the gradient of the sub-block can be determined by using all gradients of the first cross direction and the second cross direction in the first block, while the gradient of the sub-block can be determined by using only the gradient of the first cross direction or the second cross direction in the second block.
[0374] To this end, information indicating whether both the first crossing direction and the second crossing direction are used or information indicating whether it is set to use the first crossing direction or the second crossing direction may be encoded for each unit area.
[0375] The category of the luma subblock corresponding to the chroma subblock to be predicted in the chroma block is checked. When a subblock having the same category as the luma subblock exists in the reference area of the luma block, prediction for the chroma subblock can be performed by using a filter coefficient derived based on the corresponding subblock.
[0376] Specifically, the filter coefficients may be derived by using reconstructed samples included by a reference sub-block of a luma component and reconstructed samples included by a reference sub-block of a chroma component corresponding to the sub-block.
[0377] When there are a plurality of reference subblocks having the same category as the luma subblock in the reference region, the filter coefficient may be derived by using one of the plurality of subblocks. Alternatively, the reference subblocks having the same category may be grouped to derive the filter coefficient for the group. For example, when the category of the first reference subblock of the luma component is the same as the category of the second reference subblock of the luma component, the filter coefficient for the group may be derived by using the reconstructed samples included in the first reference subblock and the second reference subblock and the reconstructed samples included by the reference subblocks corresponding to the first reference subblock and the second reference subblock in the reference region of the chroma block.
[0378] Deriving filter coefficients based on the luma reconstruction samples and the chroma reconstruction samples may be based on at least one of the embodiments described in the present disclosure.
[0379] Meanwhile, when there is no reference subblock having the same category as the category of the luminance subblock, the filter coefficient set as default may be used. Here, the filter coefficient set as default may be predefined in the encoder and decoder, or may be derived for the entire reference region.
[0380] Alternatively, when there is no reference subblock having the same category as that of the luma subblock, a filter coefficient derived by using a reference subblock assigned a category index having a minimum difference between the luma subblock and the category index may be used.
[0381] The grammatical terms used in the above embodiments are only named for the convenience of description.
[0382] When an embodiment described based on a decoding process or an encoding process is applied to an encoding process or a decoding process, it is included in the scope of the present disclosure. When an embodiment described in a predetermined order is changed in an order different from the description, it is also included in the scope of the present disclosure.
[0383] The above disclosure is described based on a series of steps or flow charts, but it does not limit the time series order of the present disclosure, and if necessary, it can be performed simultaneously or in different orders. In addition, each component (e.g., unit, module, etc.) of the block diagram in the above disclosure can be implemented as a hardware device or software, and multiple components can be combined and implemented as a hardware device or software. For example, a hardware device may include at least one of a processor for performing an operation, a memory for storing data, a transmitter for sending data, and a receiver for receiving data.
[0384] The above disclosed content can be recorded in a computer-readable recording medium implemented in the form of program instructions that can be executed by various computer components. The computer-readable recording medium can include program instructions, data files, data structures, etc. alone or in combination.
[0385] In addition, according to the present disclosure, a computer-readable recording medium storing a bit stream generated by the above encoding method can be provided. The bit stream can be sent by an encoding device, and a decoding device can receive the bit stream to decode an image.
[0386] Computer-readable recording media include: hardware devices such as ROM, RAM, flash memory, etc., which are specially configured to store and execute program instructions; magnetic media such as hard disks, floppy disks, and tapes; optical recording media such as CD-ROMs, DVDs; and magneto-optical media such as optical floppy disks. Hardware devices can be configured to operate as one or more software modules to perform processing according to the present disclosure, and software devices can be configured to operate as one or more hardware modules to perform processing according to the present disclosure.
[0387] Industrial Applicability
[0388] The present disclosure may be applied to computing or electronic devices that can encode / decode video signals.
Claims
1. A method for decoding an image, the method comprising: deriving filter coefficients for prediction of a chroma block; as well as Based on the filter coefficients, a prediction sample for the chroma block is obtained by filtering a plurality of luma reconstructed samples within a luma block corresponding to the chroma block.
2. The method according to claim 1, wherein: A shape of a filter applied to the luma reconstruction samples is determined based on at least one of a shape or a size or a color format of a current block, the current block being the chroma block or the luma block.
3. The method according to claim 2, wherein: The filter is determined to be one of a plurality of filter candidates, and The plurality of filter candidates include a first filter candidate in a square shape and a second filter candidate in a non-square shape.
4. The method according to claim 1, wherein: The filter coefficients are derived based on reconstructed samples included in a luma reference region around the luma block and reconstructed samples included in a chroma reference region around the chroma block.
5. The method according to claim 4, wherein: The filter coefficients are derived based on characteristic values of reconstructed samples included in the luma reference region.
6. The method according to claim 5, wherein: The feature value is a gradient value obtained by applying a mask to the reconstructed samples included in the brightness reference region.
7. The method according to claim 6, wherein: The mask is one of a plurality of mask candidates, and Wherein, selecting the mask among the plurality of mask candidates is based on at least one of a color format or a filter shape.
8. The method according to claim 1, wherein: Prediction of the chroma block is performed in units of sub-blocks.
9. The method according to claim 8, wherein: A class index is assigned to a luma subblock corresponding to a chroma subblock in the chroma block, and The filter coefficient is derived based on a reference subblock in a reference area around the luminance block to which a class index identical to a class index assigned to the luminance subblock is assigned.
10. The method according to claim 9, wherein: The class index assigned to the luma subblock is derived based on at least one of a first cross-directional gradient or a second cross-directional gradient for reconstructed samples within the luma subblock.
11. The method according to claim 9, wherein: In a case where a reference subblock to which a class index identical to that assigned to the luma subblock is assigned does not exist within a reference region around the luma block, the filter coefficient is set to a default value.
12. The method according to claim 9, wherein: When a reference subblock assigned with the same category index as the category index assigned to the luminance subblock does not exist within a reference area around the luminance block, the filter coefficient is derived by using a reference subblock assigned with the category index assigned to the luminance subblock and a category index having a minimum difference.
13. The method according to claim 8, wherein: Whether the prediction is performed in units of the sub-block is determined based on a flag parsed from a bitstream.
14. A method for encoding an image, the method comprising: deriving filter coefficients for prediction of a chroma block; as well as Based on the filter coefficients, a prediction sample for the chroma block is obtained by filtering a plurality of luma reconstructed samples within a luma block corresponding to the chroma block.
15. A computer-readable recording medium storing a bit stream encoded by an image encoding method, the image encoding method comprising: deriving filter coefficients for prediction of a chroma block; as well as Based on the filter coefficients, a prediction sample for the chroma block is obtained by filtering a plurality of luma reconstructed samples within a luma block corresponding to the chroma block.