Method for decoding or encoding image and apparatus for transmitting compressed video data
By utilizing the intra-frame prediction mode of candidate blocks and right and bottom reference samples in video signal encoding and decoding, the problem of low coding efficiency of high-resolution video signals is solved, and more efficient intra-frame prediction is achieved.
Patent Information
- Application Number
- CN202410972381.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2018-06-21
- Filing Date
- 2019-06-21
- Publication Date
- 2024-10-08
AI Technical Summary
Existing technologies suffer from low encoding and decoding efficiency when processing high-resolution and high-quality video signals, especially when using right-side and bottom-side reference samples for intra-frame prediction, where effective methods are lacking.
By using candidate block-based intra-prediction modes, the intra-prediction mode of the current block is determined. Encoding and decoding are performed using adjacent and non-adjacent blocks. Prediction is performed by combining right and bottom reference samples. The number and priority of reference sample lines are adaptively determined to achieve effective intra-prediction.
It improves the efficiency of video signal encoding and decoding, especially when using right and bottom reference samples, thus enhancing the efficiency of intra-frame prediction.
Smart Images

Figure CN118748715A_ABST
Abstract
Description
[0001] Related Applications
[0002] This application is a divisional application of an invention patent application with an application date of June 21, 2019, an international application number of PCT / KR2019 / 007546, a Chinese application number of 201980035694.3 after entering the Chinese national phase, and an invention name of “Method and device for processing video signals”. Technical Field
[0003] The present invention relates to a method and an apparatus for processing a video signal. Background Art
[0004] Recently, the demand for high-resolution and high-quality images, such as high-definition (HD) images and ultra-high-definition (UHD) images, has increased in various application fields. However, compared with conventional image data, higher resolution and quality image data has an increased data volume. Therefore, when the image data is transmitted by using a medium such as a conventional wired and wireless broadband network, or when the image data is stored by using a conventional storage medium, the cost of transmission and storage increases. In order to solve these problems arising as the resolution and quality of image data increase, efficient image encoding / decoding technology can be used.
[0005] The image compression technology includes various technologies, including: an inter-frame prediction technology that predicts a pixel value included in a current picture based on a previous picture or a subsequent picture of the current picture; an intra-frame prediction technology that predicts a pixel value included in the current picture by using pixel information in the current picture; an entropy coding technology that assigns a short code to a value with a high frequency of occurrence and a long code to a value with a low frequency of occurrence, etc. Image data can be effectively compressed by using such an image compression technology and can be transmitted or stored.
[0006] Meanwhile, along with the demand for high-resolution images, the demand for stereoscopic image content as a new image service is also increasing. Video compression technology for efficiently providing stereoscopic image content with high resolution and ultra-high resolution is being studied. Summary of the invention
[0007] Technical issues
[0008] The present invention provides a method and apparatus for efficiently performing intra prediction on an encoding / decoding target block when encoding / decoding a video signal.
[0009] The present invention provides a method and apparatus for performing intra prediction using right reference samples and lower reference samples when encoding / decoding a video signal.
[0010] The present invention provides a method and apparatus for efficiently deriving an intra prediction mode of a current block when encoding / decoding a video signal.
[0011] Technical problems that can be obtained from the present invention are not limited to the above-mentioned technical tasks, and a person of ordinary skill in the technical field to which the present invention belongs can clearly understand other unmentioned technical tasks according to the following description.
[0012] Technical Solution
[0013] The video signal decoding method and apparatus according to the present invention can derive the most probable mode (MPM) candidate based on the intra-frame prediction mode of the candidate block, determine whether there is an MPM candidate that is the same as the intra-frame prediction mode of the current block among the MPM candidates, and derive the intra-frame prediction mode of the current block based on the determination. In this case, the candidate block may include adjacent blocks adjacent to the current block and non-adjacent blocks that are not adjacent to the current block.
[0014] The video signal encoding method and apparatus according to the present invention can derive a merge candidate from a candidate block, derive a most probable mode (MPM) candidate based on an intra prediction mode of the candidate block, determine whether there is an MPM candidate identical to an intra prediction mode of a current block among the MPM candidates, and derive an intra prediction mode of the current block based on the determination. In this case, the candidate block may include an adjacent block adjacent to the current block and a non-adjacent block not adjacent to the current block.
[0015] With the video signal encoding / decoding method and apparatus according to the present invention, the non-adjacent blocks may be spaced apart from the adjacent blocks by a predetermined value in at least one of a horizontal direction distance or a vertical direction distance.
[0016] For the video signal encoding / decoding method and apparatus according to the present invention, the predetermined distance may be determined based on at least one of the size or the shape of the current block.
[0017] For the video signal encoding / decoding method and apparatus according to the present invention, the index assigned to each MPM candidate may be determined based on the priority among the candidate blocks.
[0018] For the video signal encoding / decoding method and apparatus according to the present invention, the priority may be determined based on whether the shape of the current block is the same as the shape of the candidate block.
[0019] For the video signal encoding / decoding method and apparatus according to the present invention, deriving the intra prediction mode may include determining whether the intra prediction mode is a default mode. In this case, the determination may be based on a default mode flag signaled from a bitstream.
[0020] For the video signal encoding / decoding method and apparatus according to the present invention, the default mode may include at least one of a planar mode, a DC mode, a vertical mode, a horizontal mode, or a diagonal mode.
[0021] The method for decoding an image according to the present invention comprises the following steps: receiving a bit stream including an image; determining an intra-prediction mode of a chrominance component of a current block in the image; performing intra-prediction of the chrominance component of the current block using one or more reference sample lines of the current block based on the intra-prediction mode; and obtaining reconstructed samples of the chrominance component of the current block by using predicted samples generated by the intra-prediction, wherein the number of the one or more reference sample lines that can be used for the chrominance component of the current block is adaptively determined based on the position of the current block in a coding tree unit CTU.
[0022] The method for encoding an image according to the present invention comprises the following steps: performing intra-frame prediction of a chrominance component of a current block by using one or more reference sample lines of the current block in the image; obtaining a residual block of the chrominance component of the current block based on a prediction block generated by performing the intra-frame prediction; obtaining residual samples of the chrominance component of the current block by subtracting the prediction samples generated by the intra-frame prediction from the original samples; and generating a bit stream by encoding the residual samples, wherein the number of the one or more reference sample lines that can be used for the intra-frame prediction of the chrominance component of the current block is adaptively determined based on the position of the current block in the coding tree unit CTU.
[0023] According to the present invention, an apparatus for transmitting compressed video data comprises: a processor configured to obtain the compressed video data; and a transmitting unit configured to transmit the compressed video data, wherein obtaining the compressed video data comprises: performing intra-frame prediction of a chroma component of a current block by using one or more reference sample lines of the current block in an image; obtaining a residual block of the chroma component of the current block based on a prediction block generated by performing the intra-frame prediction; obtaining residual samples of the chroma component of the current block by subtracting the prediction samples generated by the intra-frame prediction from the original samples; and generating compressed video data by encoding the residual samples, wherein the number of the one or more reference sample lines that can be used for intra-frame prediction of the chroma component of the current block is adaptively determined based on the position of the current block in the coding tree unit CTU.
[0024] It should be understood that the above-summarized features are exemplary aspects of the following detailed description of the invention and do not limit the scope of the invention.
[0025] Beneficial Effects
[0026] According to the present invention, efficient intra prediction can be performed on an encoding / decoding target block.
[0027] According to the present invention, there is an advantage that the efficiency of intra prediction can be improved by using right reference samples and lower reference samples.
[0028] According to the present invention, there is an advantage in that an intra prediction mode is efficiently encoded / decoded by using adjacent blocks and non-adjacent blocks.
[0029] Effects that can be obtained from the present invention may not be limited to the above-mentioned effects, and other unmentioned effects may be clearly understood by a person of ordinary skill in the technical field to which the present invention pertains from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a block diagram showing an apparatus for encoding a video according to an embodiment of the present invention.
[0031] Figure 2 is a block diagram showing an apparatus for decoding a video according to an embodiment of the present invention.
[0032] Figure 3 is a diagram showing partition mode candidates that can be applied to a coding block when the coding block is encoded by inter prediction.
[0033] Figure 4 An example of hierarchical division of coding blocks based on a tree structure is shown as an embodiment to which the present invention is applied.
[0034] Figure 5 1 is a diagram showing a partition shape that allows binary tree-based partitioning as an embodiment to which the present invention is applied.
[0035] Figure 6 A ternary tree partition shape is shown.
[0036] Figure 7 is a diagram showing an example of binary tree-based partitioning that allows only specific shapes.
[0037] Figure 8 is a diagram for describing an example in which information related to the number of times binary tree division is allowed is encoded / decoded according to an embodiment to which the present invention is applied.
[0038] Fig. 9 is a diagram illustrating types of predefined intra prediction modes of an apparatus for encoding / decoding an image according to an embodiment of the present invention.
[0039] Fig.10 is a diagram showing intra prediction modes available in extended intra mode.
[0040] Fig.11is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0041] Fig.12 is a diagram showing reference sample line candidates.
[0042] Fig.13 is a diagram illustrating a method of modifying a prediction sample of a current block based on differential information of adjacent samples according to an embodiment of the present invention.
[0043] Fig.14 and Fig.15 is a diagram showing a one-dimensional reference sample group in which the reference samples are rearranged in a row.
[0044] Fig.16 is a diagram showing an example of deriving a right reference sample or a lower reference sample using a plurality of reference samples.
[0045] Fig.17 and Fig.18 2 is a diagram for explaining how to determine right reference samples and lower reference samples for a non-square block according to an embodiment of the present invention.
[0046] Fig.19 is a diagram for explaining an example of deriving a second reference sample using a first reference sample.
[0047] Fig. 20 is a diagram showing reference samples constituting a one-dimensional reference sample group.
[0048] Fig.21 is a diagram showing a region to which bidirectional intra prediction is applied.
[0049] Fig. 22 is a diagram that identifies and indicates the directional prediction mode that allows bidirectional intra prediction.
[0050] Fig.23 is a flowchart illustrating a process of determining whether to apply a bidirectional intra prediction mode according to the present invention.
[0051] Fig.24 is a diagram showing candidate blocks.
[0052] Fig.25 This is a diagram for explaining the rearrangement of MPM candidates based on the shape of a block. DETAILED DESCRIPTION
[0053] Various modifications can be made to the present invention, and there are various embodiments of the present invention, examples of which will now be provided with reference to the accompanying drawings, and examples of which will be described in detail. However, the present invention is not limited thereto, and the exemplary embodiments may be interpreted as including all modifications, equivalents or alternatives within the technical concept and technical scope of the present invention. In the accompanying drawings described, similar reference numerals refer to similar elements.
[0054] The terms 'first', 'second', etc. used in the specification may be used to describe various components, but these components should not be interpreted as being limited to these terms. These terms are only used to distinguish one component from other components. For example, without departing from the scope of the present invention, a 'first' component may be referred to as a 'second' component, and a 'second' component may also be similarly referred to as a 'first' component. The term 'and / or' includes a combination of a plurality of items or any one of a plurality of items.
[0055] In the present disclosure, when an element is referred to as being "connected" or "coupled" to another element, it should be understood that it includes not only that the element is directly connected or coupled to the other element, but also that another element may exist between them. When an element is referred to as being "directly connected" or "directly coupled" to another element, it should be understood that there are no other elements between them.
[0056] The terms used in this specification are only used to describe specific embodiments and are not intended to limit the present invention. Expressions used in the singular include expressions in the plural form unless the expression has a significantly different meaning in the context. In this specification, it should be understood that terms such as "including", "having" etc. are intended to indicate the existence of features, numbers, steps, actions, elements, parts or combinations thereof disclosed in this specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, actions, elements, parts or combinations thereof may exist or may be added.
[0057] Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. Hereinafter, the same constituent elements in the drawings are denoted by the same reference numerals, and repeated description of the same elements will be omitted.
[0058] Figure 1 is a block diagram showing an apparatus for encoding a video according to an embodiment of the present invention.
[0059] Reference Figure 1 , the device 100 for encoding a video may include: a picture division module 110, prediction modules 120 and 125, a transformation module 130, a quantization module 135, a rearrangement module 160, an entropy coding module 165, an inverse quantization module 140, an inverse transformation module 145, a filter module 150 and a memory 155.
[0060] Figure 1 The components shown in are shown independently to represent the different characteristic functions in the device for encoding the video. Therefore, this does not mean that each component is composed of a separate hardware or software component unit. In other words, for convenience, each component includes each of the listed components. Therefore, at least two components in each component can be combined to form a component, or a component can be divided into multiple components to perform each function. Without departing from the essence of the present invention, the embodiment of combining each component and the embodiment of dividing a component are also included in the scope of the present invention.
[0061] In addition, some of the components may not be indispensable components for performing the basic functions of the present invention, but selective components that only improve the performance of the present invention. The present invention can be implemented by excluding components for improving performance and only including indispensable components for implementing the essence of the present invention. Structures that exclude selective components that only improve performance and only include indispensable components are also included in the scope of the present invention.
[0062] The picture partitioning module 110 may partition an input picture into one or more processing units. Here, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture partitioning module 110 may partition a picture into a combination of a plurality of coding units, prediction units, and transform units, and may encode a picture by selecting a combination of coding units, prediction units, and transform units using a predetermined criterion (e.g., a cost function).
[0063] For example, a picture may be divided into a plurality of coding units. A recursive tree structure such as a quadtree structure may be used to divide a picture into coding units. A coding unit divided into other coding units with a picture or a maximum coding unit as a root may be divided into child nodes corresponding to the number of divided coding units. Coding units that cannot be further divided according to predetermined restrictions are used as leaf nodes. That is, when it is assumed that only square division is feasible for a coding unit, a coding unit may be divided into up to four other coding units.
[0064] Hereinafter, in an embodiment of the present invention, a coding unit may mean a unit that performs encoding or a unit that performs decoding.
[0065] The prediction unit may be one of partitions split into a square shape or a rectangular shape having the same size in a single coding unit, or the prediction unit may be one of partitions split so as to have different shapes / sizes in a single coding unit.
[0066] When a prediction unit subject to intra prediction is generated based on a coding unit and the coding unit is not a minimum coding unit, intra prediction may be performed without splitting the coding unit into a plurality of prediction units NxN.
[0067] The prediction modules 120 and 125 may include an inter prediction module 120 that performs inter prediction and an intra prediction module 125 that performs intra prediction. It may be determined whether inter prediction or intra prediction is performed for a prediction unit, and detailed information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. Here, the processing unit subjected to prediction may be different from the processing unit for which the prediction method and detailed content are determined. For example, the prediction method, prediction mode, etc. may be determined by the prediction unit, and the prediction may be performed by the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform module 130. In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value by the entropy encoding module 165, and may be transmitted to a device for decoding a video. When a specific encoding mode is used, it may be transmitted to a device for decoding a video by encoding the original block as it is without generating a prediction block through the prediction modules 120 and 125.
[0068] The inter-frame prediction module 120 may predict a prediction unit based on information of at least one of a previous picture or a subsequent picture of the current picture, or in some cases, may predict a prediction unit based on information of some coding regions in the current picture. The inter-frame prediction module 120 may include a reference picture interpolation module, a motion prediction module, and a motion compensation module.
[0069] The reference picture interpolation module may receive reference picture information from the memory 155, and may generate pixel information of integer pixels or less than integer pixels according to the reference picture. In the case of luma pixels, an 8-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 4 pixels. In the case of chrominance signals, a 4-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 8 pixels.
[0070] The motion prediction module can perform motion prediction based on the reference picture interpolated by the reference picture interpolation module. Various methods such as full search based block matching algorithm (FBMA), three-step search (TSS), new three-step search algorithm (NTS), etc. can be used as methods for calculating motion vectors. Based on the interpolated pixels, the motion vector can have a motion vector value in units of 1 / 2 pixel or 1 / 4 pixel. The motion prediction module can predict the current prediction unit by changing the motion prediction method. Various methods such as skip method, merge method, AMVP (Advanced Motion Vector Prediction) method, intra-frame block copy method, etc. can be used as motion prediction methods.
[0071] The intra prediction module 125 may generate a prediction unit based on reference pixel information adjacent to the current block, which is pixel information in the current picture. When the adjacent block of the current prediction unit is a block subject to inter-frame prediction and thus the reference pixel is a pixel subject to inter-frame prediction, the reference pixel information of the adjacent block subject to intra-frame prediction may be used to replace the reference pixel included in the block subject to inter-frame prediction. That is, when the reference pixel is unavailable, at least one reference pixel among the available reference pixels may be used to replace the unavailable reference pixel information.
[0072] The prediction mode of the intra prediction may include a directional prediction mode using reference pixel information according to a prediction direction and a non-directional prediction mode that does not use directional information when performing prediction. The mode for predicting luminance information may be different from the mode for predicting chrominance information, and in order to predict chrominance information, the intra prediction mode information for predicting luminance information or the predicted luminance signal information may be used.
[0073] When performing intra prediction, when the size of the prediction unit is the same as the size of the transform unit, intra prediction can be performed on the prediction unit based on pixels located on the left, upper left, and upper sides of the prediction unit. However, when performing intra prediction, when the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using NxN partitioning can be used only for the minimum coding unit.
[0074] In the intra prediction method, according to the prediction mode, a prediction block can be generated after applying an AIS (Adaptive Intra Smoothing) filter to a reference pixel. The type of the AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted according to the intra prediction mode of a prediction unit adjacent to the current prediction unit. When the prediction mode of the current prediction unit is predicted by using the mode information predicted according to the adjacent prediction unit, when the intra prediction mode of the current prediction unit is the same as the intra prediction mode of the adjacent prediction unit, predetermined flag information may be used to transmit information indicating that the prediction mode of the current prediction unit and the prediction mode of the adjacent prediction unit are the same as each other. When the prediction mode of the current prediction unit is different from the prediction mode of the adjacent prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.
[0075] In addition, a residual block including information on a residual value, which is a difference between the prediction unit subjected to prediction and the original block of the prediction unit, may be generated based on the prediction unit generated by the prediction modules 120 and 125. The generated residual block may be input to the transform module 130.
[0076] The transform module 130 may transform the residual block including information on the residual value between the original block and the prediction unit generated by the prediction modules 120 and 125 by using a transform method such as discrete cosine transform (DCT), discrete sine transform (DST), and KLT. Whether to apply DCT, DST, or KLT in order to transform the residual block may be determined based on intra prediction mode information of the prediction unit used to generate the residual block.
[0077] The quantization module 135 may quantize the value transformed to the frequency domain by the transform module 130. The quantization coefficient may be different according to the block or importance of the picture. The value calculated by the quantization module 135 may be provided to the inverse quantization module 140 and the rearrangement module 160.
[0078] The rearrangement module 160 may rearrange coefficients of the quantized residual value.
[0079] The rearrangement module 160 can change the coefficient of the two-dimensional block form into the coefficient of the one-dimensional vector form by the coefficient scanning method. For example, the rearrangement module 160 can use a zigzag scanning method to scan from the DC coefficient to the coefficient of the high frequency domain so that the coefficient is changed into a one-dimensional vector form. According to the size of the transform unit and the intra-frame prediction mode, the zigzag scanning can be replaced by the vertical scanning of the coefficient of the two-dimensional block form in the column direction or the horizontal scanning of the coefficient of the two-dimensional block form in the row direction. That is to say, it can be determined according to the size of the transform unit and the intra-frame prediction mode which scanning method to use among the zigzag scanning, the vertical scanning and the horizontal scanning.
[0080] The entropy encoding module 165 may perform entropy encoding based on the value calculated by the rearrangement module 160. The entropy encoding may use various encoding methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), and context adaptive binary arithmetic coding (CABAC).
[0081] The entropy coding module 165 can encode various information from the rearrangement module 160 and the prediction modules 120 and 125, such as residual value coefficient information and block type information of the coding unit, prediction mode information, partition unit information, prediction unit information, transformation unit information, motion vector information, reference frame information, block interpolation information, filtering information, etc.
[0082] The entropy encoding module 165 may entropy encode coefficients of the coding unit input from the rearrangement module 160 .
[0083] The inverse quantization module 140 may inversely quantize the value quantized by the quantization module 135, and the inverse transform module 145 may inversely transform the value transformed by the transform module 130. The residual values generated by the inverse quantization module 140 and the inverse transform module 145 may be combined with the prediction units predicted by the motion estimation module, the motion compensation module, and the intra prediction module of the prediction modules 120 and 125, so that a reconstructed block may be generated.
[0084] The filter module 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 that occurs due to the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, the pixels in several rows or columns included in the block can be the basis for determining whether to apply the deblocking filter to the current 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, when applying the deblocking filter, horizontal filtering and vertical filtering can be processed in parallel.
[0086] The offset correction module can correct the offset from the original picture in units of pixels in the picture subjected to deblocking. In order to perform offset correction on a specific picture, a method of applying an offset in consideration of edge information of each pixel or a method of dividing the pixels of the picture into a predetermined number of regions, determining the region to be subjected to performing the offset, and applying the offset to the determined region can be used.
[0087] Adaptive loop filtering (ALF) can be performed based on a value obtained by comparing a filtered reconstructed picture with an original picture. The pixels included in the picture can be divided into predetermined groups, a filter to be applied to each group in the group can be determined, and filtering can be performed separately for each group. Information on whether ALF is applied and a luminance signal can be transmitted by a coding unit (CU). The shape and filter coefficients of the filter used for ALF can be different for each block. In addition, regardless of the characteristics of the application target block, a filter for ALF of the same shape (fixed shape) can be applied.
[0088] The memory 155 may store the reconstructed block or the reconstructed picture calculated by the filter module 150. The stored reconstructed block or the reconstructed picture may be provided to the prediction modules 120 and 125 when performing inter prediction.
[0089] Figure 2 is a block diagram showing an apparatus for decoding a video according to an embodiment of the present invention.
[0090] Reference Figure 2 The apparatus 200 for decoding a video may include an entropy decoding module 210 , a rearrangement module 215 , an inverse quantization module 220 , an inverse transform module 225 , prediction modules 230 and 235 , a filter module 240 , and a memory 245 .
[0091] When a video bitstream is input from the apparatus for encoding a video, the input bitstream may be decoded according to an inverse process of the apparatus for encoding a video.
[0092] The entropy decoding module 210 may perform entropy decoding according to an inverse process of entropy encoding performed by an entropy encoding module of a device for encoding a video. For example, corresponding to a method performed by a device for encoding a video, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), and context adaptive binary arithmetic coding (CABAC) may be applied.
[0093] The entropy decoding module 210 may decode information about intra prediction and inter prediction performed by the apparatus for encoding a video.
[0094] The rearrangement module 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding module 210 based on the rearrangement method used in the apparatus for encoding a video. The rearrangement module may reconstruct and rearrange coefficients in the form of a one-dimensional vector into coefficients in the form of a two-dimensional block. The rearrangement module 215 may receive information related to coefficient scanning performed in the apparatus for encoding a video, and may perform rearrangement via a method of inversely scanning the coefficients based on the scanning order performed in the apparatus for encoding a video.
[0095] The inverse quantization module 220 may perform inverse quantization based on a quantization parameter received from the apparatus for encoding a video and coefficients of the rearranged block.
[0096] The inverse transform module 225 may perform an inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, on the quantization result of the apparatus for encoding the video, which is an inverse process of the transform, i.e., DCT, DST, and KLT, performed by the transform module. The inverse transform may be performed based on a transmission unit determined by the apparatus for encoding the video. The inverse transform module 225 of the apparatus for decoding the video may selectively perform a transform scheme (e.g., DCT, DST, and KLT) according to multiple pieces of information such as a prediction method, a size of a current block, a prediction direction, and the like.
[0097] The prediction modules 230 and 235 may generate a prediction block based on the information on prediction block generation received from the entropy decoding module 210 and previously decoded block or picture information received from the memory 245 .
[0098] As described above, similar to the operation of the apparatus for encoding a video, when performing intra prediction, when the size of the prediction unit is the same as the size of the transform unit, intra prediction can be performed on the prediction unit based on pixels located on the left, upper left, and upper sides of the prediction unit. When performing intra prediction, when the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using NxN partitioning can be used only for the minimum coding unit.
[0099] The prediction modules 230 and 235 may include a prediction unit determination module, an inter-frame prediction module, and an intra-frame prediction module. The prediction unit determination module may receive various information such as prediction unit information, prediction mode information of an intra-frame prediction method, information about motion prediction of an inter-frame prediction method, etc. from the entropy decoding module 210, may divide the current coding unit into prediction units, and may determine whether to perform inter-frame prediction or intra-frame prediction on the prediction unit. By using the information required in the inter-frame prediction of the current prediction unit received from the device for encoding a video, the inter-frame prediction module 230 may perform inter-frame prediction on the current prediction unit based on information of at least one of a previous picture or a subsequent picture of the current picture including the current prediction unit. Alternatively, inter-frame prediction may be performed based on information of some pre-reconstructed areas in the current picture including the current prediction unit.
[0100] In order to perform inter prediction, which mode of the skip mode, the merge mode, the AMVP mode, and the inter block copy mode to use as a motion prediction method of a prediction unit included in the coding unit may be determined for the coding unit.
[0101] The intra prediction module 235 can generate a prediction block based on pixel information in the current picture. When the prediction unit is a prediction unit subjected to intra prediction, intra prediction can be performed based on intra prediction mode information of the prediction unit received from the device for encoding the video. The intra prediction module 235 may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation module, and a DC filter. The AIS filter performs filtering on the reference pixels of the current block, and it can be determined whether to apply the filter according to the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixels of the current block by using the AIS filter information received from the device for encoding the video and the prediction mode of the prediction unit. 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 of the prediction unit is a prediction mode in which intra prediction is performed based on pixel values obtained by interpolating reference pixels, the reference pixel interpolation module may interpolate the reference pixels to generate reference pixels that are integer pixels or smaller than integer pixels. When the prediction mode of the current prediction unit is a prediction mode in which a prediction block is generated without interpolating reference pixels, the reference pixels may not be interpolated. When the prediction mode of the current block is a DC mode, a DC filter may generate a prediction block by filtering.
[0103] The reconstructed block or picture may be provided to the filter module 240. The filter module 240 may include a deblocking filter, an offset correction module, and an ALF.
[0104] Information about whether to apply a deblocking filter to a corresponding block or picture and information about which filter of a strong filter and a weak filter to apply when applying the deblocking filter can be received from a device for encoding a video. The deblocking filter of a device for decoding a video can receive information about the deblocking filter from a device for encoding a video, and can perform deblocking filtering on the corresponding block.
[0105] The offset correction module may perform offset correction on the reconstructed picture based on the type of offset correction applied to the picture when encoding is performed and offset value information.
[0106] The ALF may be applied to the coding unit based on information on whether the ALF is applied, ALF coefficient information, etc. received from the apparatus for encoding a video. The ALF information may be provided to be 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 block, and may provide the reconstructed picture to the output module.
[0108] As described above, in the embodiments of the present invention, for convenience of explanation, a coding unit is used as a term indicating a unit for encoding, but the coding unit may be used as a unit that performs decoding as well as encoding.
[0109] In addition, the current block may represent a target block to be encoded / decoded. And, according to the encoding / decoding step, the current block may represent a coding tree block (or coding tree unit), a coding block (or coding unit), a transform block (or transform unit), a prediction block (or prediction unit), etc. In the present specification, a 'unit' may represent a basic unit for performing a specific encoding / decoding process, and a 'block' may represent a sample array of a predetermined size. Unless otherwise specified, "block" and "unit" may be used to represent the same thing. For example, in the examples mentioned later, it can be understood that coding blocks and coding units have the same meaning as each other.
[0110] A picture can be encoded / decoded by being divided into basic blocks having a square shape or a non-square shape. At this time, the basic block can be referred to as a coding tree unit. The coding tree unit can be defined as a coding unit of the maximum size allowed within a sequence or slice. Information indicating whether the coding tree unit has a square shape or a non-square shape or information related to the size of the coding tree unit can be signaled through a sequence parameter set, a picture parameter set, or a slice header. The coding tree unit can be divided into smaller-sized partitions. At this time, if it is assumed that the depth of the partition generated by splitting the coding tree unit is 1, the depth of the partition generated by splitting the partition with a depth of 1 can be defined as 2. That is, the partition generated by splitting the partition with a depth of k in the coding tree unit can be defined as a depth of k+1.
[0111] A partition of any size generated by splitting a coding tree unit may be defined as a coding unit. A coding unit may be recursively split or divided into a basic unit for performing prediction, quantization, transformation, or loop filtering, etc. For example, a partition of any size generated by splitting a coding unit may be defined as a coding unit, or may be defined as a transformation unit or a prediction unit, which is a basic unit for performing prediction, quantization, transformation, or loop filtering, etc.
[0112] Alternatively, a prediction block having the same size as or smaller than the coding block can be determined by predictive partitioning of the coding block. For the predictive partitioning of the coding block, any one of the partitioning modes (Part_mode) showing the partitioning shape of the coding block can be specified. Information for determining the partitioning index of any one of the partitioning mode candidates can be sent with a bitstream signal. Alternatively, the partitioning index of the coding block can be determined based on the size or shape of the coding block or at least one of the coding modes. The size or shape of the prediction block can be determined based on the partitioning mode specified by the partitioning index. The partitioning mode candidates may include asymmetric partitioning shapes (e.g., nLx2N, nRx2N, 2NxnU, 2NxnD). The number or type of asymmetric partitioning mode candidates that can be used by the coding block can be determined based on the size or shape of the coding block or at least one of the coding modes.
[0113] Figure 3 is a diagram showing partition mode candidates that can be applied to a coding block when the coding block is encoded by inter prediction.
[0114] When encoding a coding block by inter-frame prediction, Figure 3 Any one of the 8 partition mode candidates shown in is applied to the coding block.
[0115] On the other hand, when the coding block is encoded by intra prediction, only the square partitioning mode may be applied to the coding block. In other words, when the coding block is encoded by intra prediction, the partitioning mode, PART_2Nx2N or PART_NxN, may be applied to the coding block.
[0116] PART_NxN can be applied when the coding block has a minimum size. In this case, the minimum size of the coding block can be predefined in the encoder and decoder. Alternatively, information related to the minimum size of the coding block can be signaled in the bitstream. In an example, the minimum size of the coding block can be signaled in the slice header. Therefore, the minimum size of the coding block can be determined differently for each slice.
[0117] In another example, the partition mode candidates that the coding block can use may be determined differently according to at least one of the size or shape of the coding block. In one example, the number or type of partition mode candidates that the coding block can use may be determined differently according to at least one of the size or shape of the coding block.
[0118] Alternatively, based on the size or shape of the coding block, the type or number of asymmetric partitioning pattern candidates that the coding block can use may be determined. The number or type of asymmetric partitioning pattern candidates that the coding block can use may be determined differently according to at least one of the size or shape of the coding block. In the example, when the coding block has a non-square shape with a width greater than the height, at least one of PART_2NxN, PART_2NxnU, or PART_2NxnD may not be used as a partitioning pattern candidate for the coding block. When the coding block has a non-square shape with a height greater than the width, at least one of PART_Nx2N, PART_nLx2N, PART_nRx2N may not be used as a partitioning pattern candidate for the coding block.
[0119] Generally, the prediction block may have a size of 4×4 to 64×64. However, when the coding block is encoded by inter-frame prediction, the prediction block may be set to not have a size of 4×4 to reduce the memory bandwidth when performing motion compensation.
[0120] Based on the partition mode, the coding block may be recursively partitioned. In other words, based on the partition mode determined by the partition index, the coding block may be partitioned and each partition generated by partitioning the coding block may be defined as a coding block.
[0121] Hereinafter, the method of dividing the coding unit will be described in more detail. In the example mentioned later, the coding unit may refer to a coding tree unit or a coding unit included in a coding tree unit. In addition, the "division" generated as the coding block is divided may refer to a "coding block". The division method mentioned later can be applied when the coding block is divided into multiple prediction blocks or transform blocks.
[0122] The coding unit may be divided by at least one line. In this case, the angle of the line dividing the coding unit may be a value in the range of 0 to 360 degrees. For example, the angle of the horizontal line may be 0 degrees, the angle of the vertical line may be 90 degrees, the angle of the diagonal line in the upper right direction may be 45 degrees, and the angle of the upper left diagonal line may be 135 degrees.
[0123] When a coding unit is divided by multiple lines, the multiple lines may all have the same angle. Alternatively, at least one of the multiple lines may have an angle different from the other lines. Alternatively, the multiple lines that divide the coding tree unit or the coding unit may have a predefined angle difference (e.g., 90 degrees).
[0124] Information about the lines dividing the coding unit may be determined by a division pattern. Alternatively, information about at least one of the number, direction, angle, or position of the lines in the block may be encoded.
[0125] For convenience of description, in an example mentioned later, it is assumed that a coding unit is divided into a plurality of coding units by using at least one of a vertical line or a horizontal line.
[0126] The number of vertical lines or horizontal lines that divide the coding unit may be at least one or more. In the example, the coding unit may be divided into 2 partitions by using one vertical line or one horizontal line. Alternatively, the coding unit may be divided into 3 partitions by using two vertical lines or two horizontal lines. Alternatively, the coding unit may be divided into 4 partitions with a width and height of 1 / 2 of the coding unit by using one vertical line or one horizontal line.
[0127] When a coding unit is divided into multiple partitions by using at least one vertical line or at least one horizontal line, the partitions may have a uniform size. Alternatively, one partition may have a different size from the other partitions, or each partition may have a different size. In the example, when the coding unit is divided by two horizontal lines or two vertical lines, the coding unit may be divided into 3 partitions. In this case, the width ratio or height ratio of the 3 partitions may be n:2n:n, 2n:n:n, or n:n:2n.
[0128] In the example mentioned later, when the coding unit is divided into 4 partitions, it is called a quadtree-based partition. And, when the coding unit is divided into 2 partitions, it is called a binary tree-based partition. In addition, when the coding unit is divided into 3 partitions, it is called a ternary tree-based partition.
[0129] In the figures mentioned later, it will be shown that the coding unit is divided using one vertical line and / or one horizontal line, but it will be described that the following case is also included in the scope of the present invention: the coding unit is divided into more divisions than shown or fewer divisions than shown by using more vertical lines than shown and / or more horizontal lines than shown.
[0130] Figure 4 An example of hierarchical division of coding blocks based on a tree structure is shown as an embodiment to which the present invention is applied.
[0131] The input video signal is decoded in predetermined block units, and the basic unit for decoding the input video signal is called a coding block. A coding block may be a unit that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., an intra prediction mode or an inter prediction mode) may be determined in units of coding blocks, and the prediction blocks included in the coding block may share the determined prediction mode. A coding block may be a square block or a non-square block of any size in the range of 8x8 to 64x64, or may be a square block or a non-square block having a size of 128x128, 256x256, or larger.
[0132] Specifically, the coding block may be hierarchically divided based on at least one of a quadtree partitioning method, a binary tree partitioning method, or a ternary tree partitioning method. Quadtree-based partitioning may mean a method of dividing a 2Nx2N coding block into four NxN coding blocks. Binary tree-based partitioning may mean a method of dividing one coding block into two coding blocks. Ternary tree-based partitioning may mean a method of dividing one coding block into three coding blocks. Even when ternary tree-based or binary tree-based partitioning is performed, square coding blocks may exist at a lower depth.
[0133] The partitions generated by the binary tree-based partitioning may be symmetric or asymmetric. In addition, the coding blocks based on the binary tree partitioning may be square blocks or non-square blocks (eg, rectangular).
[0134] Figure 52 is a diagram showing the division shape of a coding block based on binary tree division. The division shape of the coding block based on binary tree division may include a symmetric type such as 2NxN (non-square coding unit in the horizontal direction) or Nx2N (non-square coding unit in the vertical direction), or an asymmetric type such as nLx2N, nRx2N, 2NxnU, or 2NxnD. Only one of the symmetric type or the asymmetric type may be allowed as the division shape of the coding block.
[0135] The ternary tree partition shape may include at least one of a shape of dividing the coding block into 2 vertical lines or a shape of dividing the coding block into 2 horizontal lines. Three non-square partitions may be generated by the ternary tree partition.
[0136] Figure 6 A ternary tree partition shape is shown.
[0137] The ternary tree partition shape may include a shape of dividing the coding block into 2 horizontal lines or a shape of dividing the coding block into 2 vertical lines. The width ratio or height ratio of the partition generated by dividing the coding block may be n:2n:n, 2n:n:n, or n:n:2n.
[0138] The position of the partition with the largest width or height among the 3 partitions may be predefined in the encoder and the decoder. Alternatively, information showing the partition with the largest width or height among the 3 partitions may be signaled in the bitstream.
[0139] For coding units, only square partitions or symmetrically shaped non-square partitions are allowed. In this case, when the coding unit is divided into square partitions, it can correspond to a quadtree CU partition, and when the coding unit is divided into a symmetrically shaped non-square partition, it can correspond to a binary tree partition. When the coding tree unit is divided into square partitions and symmetrically shaped non-square partitions, it can correspond to a quadtree and binary tree CU partition (QTBT).
[0140] Binary tree or ternary tree based partitioning may be performed on a coding block for which quadtree based partitioning is no longer performed. A coding block generated by binary tree or ternary tree based partitioning may be divided into smaller coding blocks. In this case, at least one of quadtree partitioning, ternary tree partitioning, or binary tree partitioning may be set not to be applied to the coding block. Alternatively, for a coding block, binary tree partitioning in a predetermined direction or ternary tree partitioning in a predetermined direction may not be allowed. In an example, for a coding block generated by binary tree or ternary tree based partitioning, quadtree partitioning and ternary tree partitioning may be set to be not allowed. For the coding block, only binary tree partitioning may be allowed.
[0141] Alternatively, only the largest coding block among the three coding blocks generated by the ternary tree-based partitioning may be partitioned into smaller coding blocks. Alternatively, only the largest coding block among the three coding blocks generated by the ternary tree-based partitioning may be allowed to be partitioned based on a binary tree or partitioned based on a ternary tree.
[0142] The division shape of the lower depth division can be determined accordingly based on the division shape of the higher depth division. In the example, when the higher division and the lower division are divided based on the binary tree, for the lower depth division, only the binary tree-based division of the same shape as the binary tree division shape of the higher depth division can be allowed. For example, when the binary tree division shape of the higher depth division is 2NxN, the binary tree division shape of the lower depth division can also be set to 2NxN. Alternatively, when the binary tree division shape of the higher depth division is Nx2N, the division shape of the lower depth division can also be set to Nx2N.
[0143] Alternatively, for the maximum partition among the partitions generated by ternary-tree based partitioning, binary tree partitioning in the same partition direction as a partition at a higher depth or ternary tree partitioning in the same partition direction as a partition at a higher depth may be set to be disallowed.
[0144] Alternatively, the partition shape of the partition of the lower depth can be determined by considering the partition shape of the partition of the higher depth and the partition shape of the adjacent partition of the lower depth. Specifically, if the partition of the higher depth is partitioned based on a binary tree, the partition shape of the partition of the lower depth can be determined to avoid the same result as the partition of the higher depth is partitioned based on a quadtree. In the example, when the partition shape of the partition of the higher depth is 2NxN and the partition shape of the adjacent partition of the lower depth is Nx2N, the partition shape of the current partition of the lower depth may not be set to Nx2N. This is because when the partition shape of the current partition of the lower depth is Nx2N, it leads to the same result as the partition of the higher depth is partitioned based on a quadtree of an NxN shape. When the partition shape of the partition of the higher depth is Nx2N and the partition shape of the adjacent partition of the lower depth is 2NxN, the partition shape of the current partition of the lower depth may not be set to 2NxN. In other words, when the binary tree partition shape of a higher depth partition is different from the binary tree partition shape of an adjacent lower depth partition, the binary tree partition shape of the current lower depth partition may be set to be the same as that of the higher depth partition.
[0145] Alternatively, the binary tree division shape of the division at a lower depth may be set to be different from the binary tree division shape of the division at a higher depth.
[0146] The allowed binary tree partition shape can be determined in units of sequence, slice or coding unit. In an example, the binary tree partition shape allowed by the coding tree unit can be limited to 2NxN or Nx2N shape. The allowed partition shape can be predefined in the encoder or decoder. Alternatively, information about the allowed partition shape or the disallowed partition shape can be encoded in the bit stream and sent with a signal.
[0147] Figure 7 is a diagram showing an example of binary tree-based partitioning that allows only specific shapes.
[0148] Figure 7 (a) in FIG. 1 represents an example in which only partitioning based on a binary tree of Nx2N shape is allowed, and Figure 7 (b) in FIG. 1 shows an example in which only partitioning based on a binary tree in a 2NxN shape is allowed.
[0149] In order to represent various partition shapes, information about quadtree partition, information about binary tree partition, or information about ternary tree partition may be used. The information about quadtree partition may include at least one of information indicating whether quadtree-based partition is performed or information about the size / depth of the coding block that allows quadtree-based partition. The information about binary tree partition may include at least one of the following: information indicating whether binary tree-based partition is performed, information about whether binary tree-based partition is vertical or horizontal, information about the size / depth of the coding block that allows binary tree-based partition, or information about the size / depth of the coding block that does not allow binary tree-based partition. The information about ternary tree partition may include at least one of the following: information indicating whether ternary tree-based partition is performed, information about whether ternary tree-based partition is vertical or horizontal, information about the size / depth of the coding block that allows ternary tree-based partition, or information about the size / depth of the coding block that does not allow ternary tree-based partition. The information about the size of the coding block may represent at least one minimum or maximum value of the width, height, product of width and height, or ratio of width to height of the coding block.
[0150] In an example, when the width or height of a coding block is smaller than the minimum size of allowed binary tree partitioning, or when the partition depth of the coding block is greater than the maximum depth of allowed binary tree partitioning, binary tree-based partitioning may not be allowed for the coding block.
[0151] In an example, when the width or height of a coding block is smaller than the minimum size allowed for ternary tree partitioning, or when the partition depth of the coding block is greater than the maximum depth allowed for ternary tree partitioning, ternary tree-based partitioning may not be allowed for the coding block.
[0152] Information about conditions for allowing binary tree-based or ternary tree-based partitioning may be signaled in a bitstream. Information may be encoded in units of a sequence, a picture, or a partial image (clip). A partial image may mean at least one of a slice, a tile group, a tile, a brick, a coding block, a prediction block, or a transform block.
[0153] In an example, in a bitstream, the syntax "max_mtt_depth_idx_minus1" may be encoded / decoded in the bitstream, indicating the maximum depth allowed for binary / ternary tree partitioning. In this case, max_mtt_depth_idx_minus1+1 may indicate the maximum depth allowed for binary / ternary tree partitioning.
[0154] In an example, at least one of the number of allowed binary / ternary tree partitions, the maximum depth of allowed binary / ternary tree partitions, or the number of depths of allowed binary / ternary tree partitions may be signaled at a sequence or slice level. Thus, at least one of the number of allowed binary / ternary tree partitions, the maximum depth of allowed binary / ternary tree partitions, or the number of depths of allowed binary / ternary tree partitions may be different for a first slice and a second slice. In an example, while for a first slice, binary / ternary tree partitions may be allowed at only one depth, for a second slice, binary / ternary tree partitions may be allowed at two depths.
[0155] exist Figure 8 In the example shown in Figure 8 It is shown that binary tree partitioning is performed on a coding unit having a depth of 2 and a coding unit having a depth of 3. Therefore, at least one of the following can be encoded / decoded in a bitstream: information indicating the number of times binary tree partitioning is performed in a coding tree unit (2 times), information indicating the maximum depth (depth 3) of partitions generated by binary tree partitioning in a coding tree unit, or information indicating the number of partition depths (2 depths, depth 2 and depth 3) to which binary tree partitioning is applied in a coding tree unit.
[0156] Alternatively, the number of times binary / ternary tree divisions are allowed, the depth of binary / ternary tree divisions allowed, or the number of depths of binary / ternary tree divisions allowed may be predefined in the encoder and decoder. Alternatively, the number of times binary / ternary tree divisions are allowed, the depth of binary / ternary tree divisions allowed, or the number of depths of binary / ternary tree divisions allowed may be determined based on at least one of the index of the sequence or slice or the size / shape of the coding unit. In the example, for the first slice, binary / ternary tree division may be allowed at one depth, while for the second slice, binary / ternary tree division may be allowed at two depths.
[0157] In another example, at least one of the number of times binary tree partitioning is allowed, the depth of binary tree partitioning is allowed, or the number of depths of binary tree partitioning is allowed may be set differently according to a temporal level identifier (TemporalID) of a slice or picture. In this case, the temporal level identifier (TemporalID) is used to identify each of a plurality of image layers having at least one or more perspective, space, time, or quality.
[0158] like Figure 4 As shown in , the first coding block 300 with a division depth (split depth) of k can be divided into multiple second coding blocks based on a quadtree. For example, the second coding blocks 310 to 340 can be square blocks with a width and height halved relative to the first coding block, and the division depth of the second coding block can be increased to k+1.
[0159] The second coding block 310 with a division depth of k+1 may be divided into a plurality of third coding blocks with a division depth of k+2. The division of the second coding block 310 may be performed by selectively using one of a quadtree or a binary tree according to a division method. In this case, the division method may be determined based on at least one of information indicating a quadtree-based division or information indicating a binary tree-based division.
[0160] When the second coding block 310 is divided based on a quadtree, the second coding block 310 may be divided into four third coding blocks 310a having half the width and height of the second coding block, and the division depth of the third coding block 310a may be increased to k+2. In other words, when the second coding block 310 is divided based on a binary tree, the second coding block 310 may be divided into two third coding blocks. In this case, each of the two third coding blocks may be a non-square block with one of the width and height halved relative to the second coding block, and the division depth may be increased to k+2. The second coding block may be determined as a non-square block in the horizontal direction or in the vertical direction according to the division direction, and the division direction may be determined based on information about whether the binary tree-based division is performed in the vertical direction or in the horizontal direction.
[0161] Meanwhile, the second coding block 310 may be determined as a leaf coding block that is no longer divided based on the quadtree or the binary tree, and in this case, the corresponding coding block may be used as a prediction block or a transform block.
[0162] Similar to the division of the second coding block 310, the third coding block 310a may be determined as a leaf coding block, or may be further divided based on a quadtree or a binary tree.
[0163] On the other hand, the third coding block 310b divided based on the binary tree can be further divided into a coding block 310b-2 in the vertical direction or a coding block 310b-3 in the horizontal direction based on the binary tree, and the division depth of the corresponding coding block can be increased to k+3. Alternatively, the third coding block 310b can be determined as a leaf coding block 310b-1 that is no longer divided based on the binary tree, and in this case, the corresponding coding block 310b-1 can be used as a prediction block or a transform block. However, the above-mentioned division process can be restrictively performed based on at least one of the following: information about the size / depth of the coding block that allows quadtree-based division, information about the size / depth of the coding block that allows binary tree-based division, or information about the size / depth of the coding block that does not allow binary tree-based division.
[0164] The number of candidates representing the size of the coding block may be limited to a predetermined number, or the size of the coding block in a predetermined unit may have a fixed value. In an example, the size of the coding block in a sequence or in a picture may be limited to any one of 256x256, 128x128, or 32x32. Information representing the size of the coding block in the sequence or in the picture may be signaled in a sequence header or a picture header.
[0165] As a result of quadtree and binary tree based partitioning, the coding unit can be represented as a square or rectangular shape of any size.
[0166] like Figure 4 As shown in , the first coding block 300 with a division depth (split depth) of k can be divided into multiple second coding blocks based on a quadtree. For example, the second coding blocks 310 to 340 can be square blocks with half the width and height of the first coding block, and the division depth of the second coding block can be increased to k+1.
[0167] The second coding block 310 with a division depth of k+1 may be divided into a plurality of third coding blocks with a division depth of k+2. The division of the second coding block 310 may be performed by selectively using one of a quadtree or a binary tree according to a division method. In this case, the division method may be determined based on at least one of information indicating a quadtree-based division or information indicating a binary tree-based division.
[0168] When the second coding block 310 is divided based on a quadtree, the second coding block 310 may be divided into four third coding blocks 310a whose width and height are halved relative to the second coding block, and the division depth of the third coding block 310a may be increased to k+2. In other words, when the second coding block 310 is divided based on a binary tree, the second coding block 310 may be divided into two third coding blocks. In this case, each of the two third coding blocks may be a non-square block whose width and height are halved relative to the second coding block, and the division depth may be increased to k+2. The second coding block may be determined as a non-square block in the horizontal direction or in the vertical direction according to the division direction, and the division direction may be determined based on information about whether the binary tree-based division is performed in the vertical direction or in the horizontal direction.
[0169] Meanwhile, the second coding block 310 may be determined as a leaf coding block that is no longer divided based on the quadtree or the binary tree, and in this case, the corresponding coding block may be used as a prediction block or a transform block.
[0170] Similar to the division of the second coding block 310, the third coding block 310a may be determined as a leaf coding block, or may be further divided based on a quadtree or a binary tree.
[0171] On the other hand, the third coding block 310b divided based on the binary tree can be further divided into a coding block 310b-2 in the vertical direction or a coding block 310b-3 in the horizontal direction based on the binary tree, and the division depth of the corresponding coding block can be increased to k+3. Alternatively, the third coding block 310b can be determined as a leaf coding block 310b-1 that is no longer divided based on the binary tree, and in this case, the corresponding coding block 310b-1 can be used as a prediction block or a transform block. However, the above-mentioned division process can be restrictively performed based on at least one of the following: information about the size / depth of the coding block that allows quadtree-based division, information about the size / depth of the coding block that allows binary tree-based division, or information about the size / depth of the coding block that does not allow binary tree-based division.
[0172] The number of candidates representing the size of the coding block may be limited to a predetermined number, or the size of the coding block in a predetermined unit may have a fixed value. In an example, the size of the coding block in a sequence or in a picture may be limited to any one of 256x256, 128x128, or 32x32. Information representing the size of the coding block in the sequence or in the picture may be signaled in a sequence header or a picture header.
[0173] As a result of quadtree and binary tree based partitioning, the coding unit can be represented as a square or rectangular shape of any size.
[0174] The transform skip may be set not to be used for a coding unit generated by binary tree-based partitioning or ternary tree-based partitioning. Alternatively, the transform skip may be set to be applied to at least one of a vertical direction or a horizontal direction in a non-square coding unit. In the example, when the transform skip is applied to the horizontal direction, it means that only scaling is performed without transform / inverse transform in the horizontal direction, and transform / inverse transform using DCT or DST is performed in the vertical direction. When the transform skip is applied to the vertical direction, it means that only scaling is performed without transform / inverse transform in the vertical direction, and transform / inverse transform using DCT or DST is performed in the horizontal direction.
[0175] Information about whether inverse transform for the horizontal direction is skipped or information about whether inverse transform for the vertical direction is skipped may be signaled in a bitstream. In an example, information about whether inverse transform for the horizontal direction is skipped may be a 1-bit flag 'hor_transform_skip_flag', and information about whether inverse transform for the vertical direction is skipped may be a 1-bit flag 'ver_transform_skip_flag'.
[0176] The encoder may determine whether to encode 'hor_transform_skip_flag' or 'ver_transform_skip_flag' according to the size and / or shape of the current block. In an example, when the current block has an Nx2N shape, hor_transform_skip_flag may be encoded and the encoding of ver_transform_skip_flag may be omitted. When the current block has a 2NxN shape, ver_transform_skip_flag may be encoded and hor_transform_skip_flag may be omitted.
[0177] Alternatively, based on the size and / or shape of the current block, it may be determined whether to perform transform skipping in the horizontal direction or whether to perform transform skipping in the vertical direction. In an example, when the current block has an Nx2N shape, transform skipping may be applied to the horizontal direction, and transform / inverse transform may be performed in the vertical direction. When the current block has a 2NxN shape, transform skipping may be applied to the vertical direction, and transform / inverse transform may be performed in the horizontal direction. Transform / inverse transform may be performed based on at least one of DCT or DST.
[0178] As a result of partitioning based on a quadtree, a binary tree, or a ternary tree, a coding block that is no longer divided can be used as a prediction block or a transform block. In other words, a coding block generated by quadtree partitioning or binary tree partitioning can be used as a prediction block or a transform block. In the example, a predicted image can be generated in units of coding blocks, and the difference between the residual signal, the original image, and the predicted image can be transformed in units of coding blocks. In order to generate a predicted image in units of coding blocks, motion information can be determined based on the coding blocks, or an intra-frame prediction mode can be determined based on the coding blocks. Therefore, the coding block can be encoded by using at least one of a skip mode, an intra-frame prediction, or an inter-frame prediction.
[0179] Alternatively, multiple coding blocks generated by dividing the coding block may be set to share at least one of motion information, merge candidates, reference samples, reference sample rows, or intra-frame prediction modes. In an example, when the coding block is divided by a ternary tree, the divisions generated by dividing the coding block may share at least one of motion information, merge candidates, reference samples, reference sample rows, or intra-frame prediction modes according to the size or shape of the coding block. Alternatively, only a portion of the multiple coding blocks may be set to share information, and the remaining coding blocks may be set to not share information.
[0180] In another example, a prediction block or a transform block smaller than the coding block may be used by partitioning the coding block.
[0181] Hereinafter, a method of performing intra prediction on a coding block or a prediction block or a transform block generated by splitting the coding block will be described in detail.
[0182] Fig. 9 is a diagram illustrating types of predefined intra prediction modes of an apparatus for encoding / decoding a video according to an embodiment of the present invention.
[0183] The apparatus for encoding / decoding a video may perform intra prediction using one of the predefined intra prediction modes. The predefined intra prediction modes for intra prediction may include a non-directional prediction mode (eg, planar mode, DC mode) and 33 directional prediction modes.
[0184] Alternatively, in order to improve the accuracy of intra-frame prediction, more than 33 directional prediction modes can be defined. That is, M extended directional prediction modes (M>33) can be defined by further subdividing the angle of the directional prediction mode. A directional prediction mode different from the existing 33 directional prediction modes can be derived based on at least one of the existing 33 directional prediction modes.
[0185] Therefore, we can define the ratio Fig. 935 intra prediction modes are shown. If the number of available intra prediction modes is greater than Fig. 9 35 as shown in , the available intra prediction mode can be called extended intra mode.
[0186] Fig.10 2 is a diagram showing intra prediction modes available in extended intra mode. In extended intra mode, available intra prediction modes may be configured with 2 non-directional prediction modes and 65 extended directional prediction modes.
[0187] The number of available intra prediction modes may be set equally for the luminance component and the chrominance component. Alternatively, the number of available intra prediction modes for each color component may be different. For example, any one of 67 intra prediction modes may be selected and used for the luminance component, and any one of 35 intra prediction modes may be selected and used for the chrominance component.
[0188] Alternatively, the number of available intra prediction modes may be different depending on the color format. For example, in a 4:2:0 format, 67 intra prediction modes may be set to be available for luma components, and 35 intra prediction modes may be set to be available for chroma components. In a 4:4:4 format, 67 intra prediction modes may be set to be available for both luma components and chroma components.
[0189] Alternatively, the number of available intra prediction modes may be different depending on the size and / or shape of the block. Specifically, the number of available intra prediction modes may be determined to be 35 or 67 depending on the size and / or shape of the PU, TU, or CU. For example, when the size of the CU, TU, or PU is less than 64×64, or when the CU, TU, or PU is asymmetrically divided, the number of available intra prediction modes may be 35. On the other hand, when the size of the CU, TU, or PU is 64x64 or larger, or when the CU, TU, or PU is symmetrically divided, the number of available intra prediction modes may be set to 67.
[0190] Alternatively, for Intra_2Nx2N partitioning, the number of available directional intra prediction modes may be set to 65. On the other hand, for Intra_NxN partitioning, the number of available directional intra prediction modes may be set to 33.
[0191] Whether to apply the extended intra mode may be determined based on at least one of the size, shape, or color component of the block. In this case, information indicating the size or shape of the block to which the extended intra mode is applied may be signaled via the bitstream. The information may be signaled at a sequence, picture, or slice level. Thus, the size of the block to which the extended intra mode is applied may be different for each sequence, picture, or slice. For example, in a first slice, the extended intra mode may be set to apply to blocks larger than 64x64 (e.g., CU, TU, or PU), while in a second slice, the extended intra mode may be set to apply to blocks larger than 32x32.
[0192] Information indicating the size of a block to which the extended intra mode is applied may be obtained by taking a logarithmic value from the size of a reference block and then subtracting a predetermined value. For example, "log2_extended_intra_mode_size_minus4" obtained by subtracting an integer 4 from a value obtained by taking a logarithmic value from the size of a reference block may be encoded. For example, when the value of log2_extended_intra_mode_size_minus4 is 0, it indicates that the extended intra mode is applied to a block having a size of 16x16 or more or a block having a size greater than 16x16, and when the value of log2_extended_intra_mode_size_minus4 is 1, it may indicate that the extended intra mode is applied to a block having a size of 32x32 or more or a block having a size greater than 32x32.
[0193] As described above, the number of available intra prediction modes may be determined based on at least one of the chrominance component, color format, size, or shape of the block. Intra prediction for the current block may be performed based on at least one of the available intra prediction modes.
[0194] In addition, the number of intra prediction mode candidates (e.g., the number of MPMs) for determining the intra prediction mode of the current block to be encoded / decoded may also be determined according to at least one of the color component, color format, or size or shape of the block. Figure 8 The intra prediction modes shown are more numerous than the intra prediction modes. For example, by further subdividing Figure 8 The directional prediction mode shown in FIG. 1 may also use 129 directional prediction modes and 2 non-directional prediction modes. At least one of the color component, color format component, size, or shape of the block in the example described above may be considered to determine whether to use the directional prediction mode. Figure 8 A greater number of intra prediction modes than the intra prediction modes shown in .
[0195] With reference to the drawings to be described later, a method of determining an intra prediction mode of a current block to be encoded / decoded and a method of performing intra prediction using the determined intra prediction mode will be described through the drawings.
[0196] With reference to the drawings to be described later, a method of determining an intra prediction mode of a current block to be encoded / decoded and a method of performing intra prediction using the determined intra prediction mode will be described through the drawings.
[0197] Fig.11 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0198] First, a reference sample line index of a current block may be determined (S1110). The reference sample line index may be used to determine a reference sample line for performing intra prediction of the current block. Intra prediction of the current block may be performed using at least one reference sample line indicated by the reference sample line index among a plurality of reference sample lines.
[0199] Fig.12 is a diagram showing reference sample line candidates.
[0200] The Nth reference sample line may include an upper reference sample and a left reference sample, wherein the y coordinate of the upper reference sample is N less than the uppermost row of the current block, and the x coordinate of the left reference sample is N less than the leftmost column of the current block. Fig.12 In the example shown, the reference sample index is N-1. The Nth reference sample line may include upper reference samples from P(-N, -N) to P(2W+N-1, -N) and left reference samples from P(-N, -N) to P(-N, 2H+N-1). For example, reference sample line 1 may include upper reference samples from P(-2, -2) to P(2W+1, -2) and left reference samples from P(-2, -2) to P(-2, 2H+1).
[0201] The number of reference sample lines that can be used as reference sample line candidates may be 1, 2, 3, 4, or more. Fig.12 In the example shown, reference sample line 0, reference sample line 1, and reference sample line 3 may be used as reference sample line candidates.
[0202] The number of reference sample lines or the positions of reference sample lines that can be used as reference sample line candidates can be determined based on at least one of the size, shape, intra-frame prediction mode or position of the current block. For example, when the current block is located near the boundary of the CTU or the boundary of the tile, the number of reference sample line candidates can be 1 (for example, reference sample line 0). When the current block is not located near the boundary of the CTU or the boundary of the tile, the number of reference sample line candidates can be 3 (for example, reference sample line 0, reference sample line 1, reference sample line 3). For example, when the intra-frame prediction mode of the current block is within a first range, reference sample line 0, reference sample line 1 and reference sample line 3 can be used as reference sample line candidates. When the intra-frame prediction mode of the current block is within a second range, reference sample line 0, reference sample line 2 and reference sample line 2 can be used as reference sample line candidates.
[0203] Information specifying at least one of the reference sample line candidates may be signaled through a bitstream. When the number of available reference sample line candidates is 1, encoding of index information may be omitted. When index information is not encoded, reference sample line 0 adjacent to the current block may be considered selected.
[0204] Alternatively, at least one of the reference sample line candidates may be selected based on at least one of the size, shape, position, or intra prediction mode of the current block. For example, when at least one of the width, height, and size of the current block is less than a predefined value, reference sample line 0 may be selected. For example, when the current block is located on the upper boundary of a CTU or tile, reference sample line 0 may be selected.
[0205] Alternatively, the reference sample line may be selected based on whether the current block is divided into sub-blocks. For example, when the current block is divided into sub-blocks, the reference sample line 0 may be selected.
[0206] Alternatively, when the current block is divided into a plurality of sub-blocks, a reference sample line may be determined for each sub-block. Alternatively, all sub-blocks may be defined to have the same reference sample line index.
[0207] When the current block is divided into a plurality of subblocks, intra prediction may be performed in units of subblocks.
[0208] Multiple reference sample lines may be selected for the current block. Whether to use multiple reference sample lines to perform intra prediction may be adaptively determined according to the size, shape, or intra prediction mode of the current block. For example, when the intra prediction mode of the current block is a non-directional prediction mode or a predefined directional intra prediction mode, multiple reference sample lines may not be used. The predefined directional intra prediction mode may include at least one of a vertical intra prediction mode, a horizontal intra prediction mode, and a diagonal intra prediction mode.
[0209] The plurality of reference sample lines may include a reference sample line selected by the index information and a reference sample line obtained by adding or subtracting a predefined value from the reference sample line index. Here, the predefined value may be 1 or 2.
[0210] Alternatively, a plurality of index information may be signaled through a bitstream, each of the plurality of index information indicating a different reference sample line.
[0211] The prediction sample may be obtained based on at least one of a weighted sum operation, an average operation, a minimum operation, or a maximum operation of the plurality of reference samples. Here, the reference sample line index including at least one of the plurality of reference samples may be different from the reference sample line index including the remaining reference samples.
[0212] Next, the intra prediction mode of the current block may be determined (S1220).
[0213] In order to determine the intra prediction mode of the current block, the most probable mode (MPM) candidate may be derived based on the intra prediction mode of the neighboring block adjacent to the current block. Here, the neighboring block may include at least one of the blocks adjacent to the upper side, lower side, left side, right side or corner of the current block. For example, the MPM candidate may be derived based on the intra prediction mode of the upper neighboring block and the intra prediction mode of the left neighboring block. The upper neighboring block may include an upper neighboring sample at a predefined position having a smaller y coordinate value than the uppermost row of the current block. The predefined position may be (0, -1), (W / 2, -1), (W-1, -1) or (W, -1). (0, 0) indicates the position of the upper left sample included in the current block, and W indicates the width of the current block. The left neighboring block may include a left neighboring sample at a predefined position having a smaller x coordinate value than the leftmost column of the current block. The predefined position may be (-1, 0), (-1, H / 2), (-1, H-1) or (-1, H). H represents the height of the current block. If the neighboring block is encoded in inter prediction, the intra prediction mode of the neighboring block or the intra prediction mode of the collocated block of the current block may be used to include the MPM candidate.
[0214] The number of MPM (most probable mode) candidates included in the candidate list may be 3, 4, 5, 6 or more. The maximum number of MPM candidates may be a fixed value predetermined in the image encoder / decoder. Alternatively, the maximum number of MPM candidates may be determined based on the properties of the current block. The property may include at least one of the following items: the position / size / shape of the current block, the number / type of intra-prediction modes that the current block can use, the color type (luminance / chrominance) of the current block, the color format of the current block, or whether the current block is divided into multiple sub-blocks. Alternatively, information indicating the maximum number of MPM candidates may be signaled via a bitstream. The information indicating the maximum number may be signaled at at least one of a sequence level, a picture level, a slice level, or a block level.
[0215] The intra prediction mode of the adjacent block, the directional intra prediction mode similar to the adjacent block, or the default mode may be set as the MPM candidate. A directional intra prediction mode similar to the adjacent block may be derived by adding or subtracting a predefined value from the intra prediction mode of the adjacent block. The predefined value may be an integer of 1, 2 or more. The predefined value may be adaptively determined according to the number of available intra prediction modes. For example, when the number of available intra prediction modes is 35, the predefined value may be set to 1, and when the number of available intra prediction modes is 67, the predefined value may be set to 2. In addition, when the available intra prediction mode is 131, the predefined value may be set to 4. When both the intra prediction mode of the first adjacent block and the intra prediction mode of the second adjacent block are directional prediction modes, a similar directional intra prediction mode may be derived based on the maximum value of the intra prediction mode of the first adjacent block and the intra prediction mode of the second adjacent block. The default mode may include at least one of a DC mode, a plane mode, a horizontal prediction mode, a vertical prediction mode, an upper right diagonal mode, a lower left diagonal mode, or an upper left diagonal mode. When the number of MPM candidates included in the MPM candidate list is less than the maximum number, a default mode different from the MPM candidate previously inserted in the MPM candidate list may be inserted into the MPM candidate list. The number, type, or priority of the default mode may be different according to at least one of a reference sample line index of the current block, whether an intra prediction technique in units of subblocks is applied to the current block, or a partition type of the current block.
[0216] The MPM candidate index may be determined according to a predefined order. For example, when the intra prediction mode of the left neighboring block is different from the intra prediction mode of the upper neighboring block, the index value of the intra prediction mode of the left neighboring block may be smaller than the index value of the intra prediction mode of the upper neighboring block.
[0217] Alternatively, the MPM candidate index may be determined according to the size / type of the current block. For example, when the current block has a non-square shape with a height greater than the width, the intra-prediction mode of the upper neighboring block may have an index value smaller than the index value of the intra-prediction mode of the left neighboring block. When the current block has a non-square shape with a width greater than the height, the intra-prediction mode of the left neighboring block may have an index value smaller than the index value of the intra-prediction mode of the upper neighboring block.
[0218] Alternatively, only N predefined intra prediction modes can be used as MPM candidates. When the intra prediction mode of the adjacent block is different from the predefined N intra prediction modes, the intra prediction mode of the adjacent block is transformed into one of the predefined N intra prediction modes, and the transformed intra prediction mode can be set as the MPM candidate. A predefined table can be used for the transformation of the intra prediction mode, or a scaling operation based on a predetermined value can be used. Here, the predefined table can define the mapping relationship between the intra prediction modes.
[0219] For example, when the neighboring block is encoded in non-extended intra mode (i.e., the available intra prediction mode is 35), and when the current block is encoded in extended intra mode (i.e., the available intra prediction mode is 67), the intra prediction mode index of the neighboring block can be transformed into the intra prediction mode index in the extended intra mode. For example, when the intra prediction mode of the left neighboring block is 10 (horizontal mode), it can be converted to index 18 corresponding to the horizontal mode in the extended intra mode.
[0220] Alternatively, when the adjacent block is encoded in the extended intra mode and the current block is encoded in the non-extended intra mode, the intra prediction mode index of the adjacent block can be transformed into the intra prediction mode index in the non-extended intra mode. For example, when the intra prediction mode index of the upper adjacent block is 50 (vertical mode), it can be transformed into the index 26 corresponding to the vertical mode in the non-extended intra mode.
[0221] When the reference sample line index selected by step S1110 is greater than or equal to a predefined value, the candidate list may be set to not include the DC mode and / or the planar mode. The predefined value may be an integer of 1 or greater.
[0222] When the current block is divided into a plurality of sub-blocks, the current candidate list may be set to not include the DC mode and / or the plane mode. In addition, the default mode may be included in the candidate list. In this case, the number or type of the default mode may be different depending on the partition type of the current block.
[0223] The following information may be signaled through the bitstream: the information indicating whether the candidate list includes the same MPM candidate as the intra prediction mode of the current block. For example, the MPM flag may be signaled through the bitstream. When the value of the MPM flag is 0, it indicates that the candidate list does not include the same MPM candidate as the intra prediction mode of the current block. When the value of the MPM flag is 1, it indicates that the candidate list includes the same MPM candidate as the intra prediction mode of the current block.
[0224] When the MPM flag indicates that there is an MPM candidate identical to the intra prediction mode of the current block, index information of one of the MPM candidates included in the candidate list may be sent by a bitstream signal. The MPM candidate specified by the index information may be set as the intra prediction mode of the current block. When encoding / signaling of the MPM flag is omitted, it may be determined that the MPM candidate identical to the intra prediction mode of the current block is included in the candidate list.
[0225] On the other hand, when the MPM flag indicates that there is no MPM candidate that is the same as the intra-frame prediction mode of the current block, the remaining mode information may be signaled through the bitstream. The remaining mode information is used to specify any one of the remaining intra-frame prediction modes other than the MPM candidates included in the candidate list. Using the remaining mode information, the intra-frame prediction mode of the current block may be determined. When the MPM flag indicates that there is no MPM candidate that is the same as the intra-frame prediction mode of the current block, the MPM candidates may be rearranged in ascending order. Thereafter, the mode value indicated by the remaining mode information may be sequentially compared with the rearranged MPM candidates to derive the intra-frame prediction mode of the current block. For example, when the mode value indicated by the remaining mode information is less than or equal to the rearranged MPM candidate, 1 may be added to the mode value. If there is no MPM candidate that is smaller than the updated mode value, the updated mode value may be determined as the intra-frame prediction mode of the current block.
[0226] When the reference sample line index selected by step S1110 is greater than or equal to a predefined value, the encoding of the MPM flag can be omitted. Therefore, when the reference sample line index is greater than or equal to a predefined value, the intra prediction mode of the current block can be set to the MPM candidate indicated by the index information.
[0227] As described above, when the reference sample line index is greater than or equal to a predefined value, the candidate list can be set to not include the DC mode and / or the plane mode. Therefore, when the reference sample line index is greater than or equal to the predefined value, the DC mode and / or the plane mode cannot be applied to the current block.
[0228] Information indicating whether the intra-frame prediction mode of the current block is a default mode may be sent by a bitstream signal. The default mode may include at least one of DC, plane, horizontal mode, vertical mode, or diagonal mode. For example, a default mode flag indicating whether the intra-frame prediction mode of the current block is the same as the default mode may be sent by a bitstream signal. The default mode flag may include at least one of the following: a flag indicating whether the intra-frame prediction mode of the current block is a plane mode, a flag indicating whether the intra-frame prediction mode of the current block is a DC mode, a flag indicating whether the intra-frame prediction mode of the current block is a vertical mode, a flag indicating whether the intra-frame prediction mode of the current block is a horizontal mode, or a flag indicating whether the intra-frame prediction mode of the current block is a diagonal mode.
[0229] For example, is_planar_not_flag may be signaled through a bitstream. When the value of the flag is 0, it indicates that the intra prediction mode of the current block is the planar mode. When the value of the flag is 1, it indicates that the intra prediction mode of the current block is not the planar mode.
[0230] When the MPM flag indicates that there is an MPM candidate that is the same as the intra prediction mode of the current block, the default mode flag may be signaled. When the default mode flag indicates that the intra prediction mode of the current block is not the default mode, the MPM candidate specified by the index information may be set as the intra prediction mode of the current block.
[0231] When the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks may share the intra-prediction mode of the current block. Alternatively, the intra-prediction mode may be determined for each sub-block. For example, information and / or residual mode may be encoded / decoded for each sub-block. Alternatively, information indicating whether the intra-prediction mode of the sub-block is the same as the sub-block on which the previous encoding / decoding has been completed may be signaled via a bitstream. Alternatively, the intra-prediction mode of the current sub-block may be derived by adding / subtracting an offset to the intra-prediction mode of the sub-block on which the previous encoding / decoding has been completed.
[0232] When the current block is divided into a plurality of sub-blocks, encoding of the MPM flag may be omitted. Therefore, when the current block is divided into a plurality of sub-blocks, the intra prediction mode of the current block may be set to the MPM candidate indicated by the index information.
[0233] Multiple sub-blocks can share the intra prediction mode of the current block.
[0234] The intra prediction mode of each of the luma component and the chroma component may be determined independently. Alternatively, the intra prediction mode of the chroma component may be determined according to the intra prediction mode of the luma component.
[0235] Specifically, as shown in Table 1 below, the intra prediction mode of the chrominance component may be determined based on the intra prediction mode of the luminance component.
[0236] [Table 1]
[0237]
[0238]
[0239] In Table 1, intra_chroma_pred_mode represents information signaled to specify an intra prediction mode of a chroma component, and IntraPredModeY indicates an intra prediction mode of a luma component.
[0240] Next, the reference samples of the current block may be derived (S1130). For example, when the Nth reference sample line is selected by step S1110, the upper reference samples from P(-N, -N) to P(2W+N-1, -N) and the left reference samples from P(-N, -N) to P(-N, 2H+N-1) may be derived.
[0241] The reference sample may be derived from a reconstructed sample that has been encoded / decoded before the current block. The reconstructed sample may represent a state before applying the loop filter or a state after applying the loop filter.
[0242] A predetermined intra-frame filter may be applied to a reference sample. Filtering a reference sample using an intra-frame filter may be referred to as reference sample smoothing. The intra-frame filter may include at least one of a first intra-frame filter applied in a horizontal direction or a second intra-frame filter applied in a vertical direction. One of the first intra-frame filter or the second intra-frame filter may be selectively applied according to the position of the reference sample. Alternatively, two intra-frame filters may be repeatedly applied to one reference sample. At least one of the filter coefficients in the first intra-frame filter or the second intra-frame filter may be (1, 2, 1), but is not limited thereto.
[0243] Filtering may be adaptively performed based on at least one of the intra prediction mode of the current block or the size of the transform block for the current block. For example, when the intra prediction mode of the current block is a DC mode, a vertical mode, or a horizontal mode, filtering may not be performed. When the size of the transform block is N×M, filtering may not be performed. Here, N and M may be the same value or different values, or may be 4, 8, 16 or greater. For example, if the size of the transform block is 4×4, filtering may not be performed. Alternatively, it may be determined whether filtering is performed based on the result of a comparison of a predefined threshold with the difference between the intra prediction mode and the vertical mode (or horizontal mode) of the current block. For example, filtering may be performed when the difference between the intra prediction mode and the vertical mode of the current block is greater than a threshold. As shown in Table 2, a threshold may be defined for each size of the transform block.
[0244] [Table 2]
[0245] 8x8 Transform 16x16 Transform 32x32 Transform Threshold 7 1 0
[0246] The intra filter may be determined as one of a plurality of intra filter candidates predefined in the apparatus for encoding / decoding a video. To this end, a separate index of the intra filter for the current block may be specified in the plurality of intra filter candidates by signaling. Alternatively, the intra filter may be determined based on at least one of the size / shape of the current block, the size / shape of the transform block, information on filter strength, or a change in surrounding samples.
[0247] Next, intra prediction may be performed using the intra prediction mode and reference samples of the current block ( S1140 ).
[0248] The prediction sample may be obtained by using the intra prediction mode and the reference sample of the current block. When multiple reference sample lines are selected, the prediction sample may be obtained based on a weighted operation or an average operation of reference samples belonging to different reference sample lines. As an example, the prediction sample may be derived based on a weighted sum operation of a first reference sample belonging to a first reference sample line and a second reference sample belonging to a second reference sample line. In this case, the weight applied to the first reference sample and the second reference sample may have the same value. Alternatively, the weight applied to each reference sample may be determined based on the distance between the prediction target sample and the reference sample. For example, in the first reference sample and the second reference sample, the weight applied to the reference sample having a close distance to the prediction target sample may have a larger value than the weight applied to other reference samples.
[0249] However, in the case of intra prediction, boundary samples of adjacent blocks may be used, and therefore, the quality of the predicted picture may be reduced. Therefore, a correction process may be performed on the predicted samples generated by the above prediction process, and the reference Fig.13However, the correction process is not limited to being applied only to intra-prediction samples, but can be applied to inter-prediction samples or reconstructed samples.
[0250] Fig.13 is a diagram illustrating a method of correcting a prediction sample of a current block based on differential information of adjacent samples according to an embodiment of the present invention.
[0251] The prediction samples of the current block may be corrected based on differential information of a plurality of adjacent samples of the current block. The correction may be performed on all prediction samples in the current block, or may be performed on prediction samples in a predetermined partial area. The partial area may be a row / column or a plurality of rows / columns, and these may be preset areas for correction in a device for encoding / decoding a video. For example, correction may be performed on a row / column located at the boundary of the current block, or correction may be performed on a plurality of rows / columns away from the boundary of the current block. Alternatively, the partial area may be variably determined based on at least one of the size / shape of the current block or the intra prediction mode.
[0252] The neighboring samples may belong to neighboring blocks located at the upper side, the left side, and the upper left corner of the current block. The number of neighboring samples used for correction may be two, three, four, or more. The positions of the neighboring samples may be variably determined according to the positions of the prediction samples as the correction target in the current block. Alternatively, some of the neighboring samples may have fixed positions regardless of the positions of the prediction samples as the correction target, and the remaining neighboring samples may have variable positions according to the positions of the prediction samples as the correction target.
[0253] The differential information of adjacent samples may represent differential samples between adjacent samples, or may represent a value obtained by scaling the differential samples by a predetermined constant value (e.g., one, two, three, etc.). Here, the predetermined constant value may be determined in consideration of the following positions: the position of the prediction sample as the correction target, including the position of the column or row of the prediction sample as the correction target, the position of the prediction sample within the column, row, etc.
[0254] For example, as shown in Formula 1, when the intra prediction mode of the current block is a vertical mode, the final prediction sample can be obtained using the differential sample between the upper left adjacent sample p(-1, -1) and the adjacent sample p(-1, y) adjacent to the left boundary of the current block.
[0255] [Formula 1]
[0256] P′(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1 for y=0...N-1
[0257] For example, as shown in Formula 1, when the intra prediction mode of the current block is a horizontal mode, the final prediction sample can be obtained using the differential sample between the upper left adjacent sample p(-1, -1) and the adjacent sample p(x, -1) adjacent to the upper boundary of the current block.
[0258] [Formula 2]
[0259] P′(x,0)=p(x,0)+((p(x,-1)-p(-1,-1))>>1 for x=0...N-1
[0260] For example, as shown in Formula 2, when the intra prediction mode of the current block is a vertical mode, the final prediction sample can be obtained using the difference sample between the upper left adjacent sample p (-1, -1) and the adjacent sample p (-1, y) adjacent to the left boundary of the current block. Here, the difference sample can be added to the prediction sample, or the difference sample can be scaled by a predetermined constant value and then added to the prediction sample. The predetermined constant value for scaling can be determined differently according to the column and / or row. For example, the prediction sample can be corrected as shown in Formulas 3 and 4.
[0261] [Formula 3]
[0262] P′(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1 for y=0...N-1
[0263] [Formula 4]
[0264] P′(1,y)=P(1,y)+((p(-1,y)-p(-1,-1))>>2 for y=0...N-1
[0265] For example, when the intra prediction mode of the current block is the horizontal mode, the final prediction sample can be obtained using the difference sample between the upper left adjacent sample p (-1, -1) and the adjacent sample p (x, -1) adjacent to the left boundary of the current block. This is the same as described above in the horizontal mode. For example, the prediction sample can be corrected as shown in the following formulas 5 and 6.
[0266] [Formula 5]
[0267] P′(x,0)=p(x,0)+((p(x,-1)-p(-1,-1))>>1 for x=0...N-1
[0268] [Formula 6]
[0269] P′(x, 1)=p(x, 1)+((p(x, -1)-p(-1, -1))>>2 for x=0...N-1
[0270] When the intra prediction mode of the current block is a directional prediction mode, the intra prediction of the current block can be performed based on the directionality of the directional prediction mode. For example, Table 3 shows the intra directional parameters intraPredAng from mode 2 to mode 34, which are Fig. 9 Directional intra prediction modes are shown.
[0271] [Table 3]
[0272]
[0273]
[0274] In Table 3, 33 directional intra prediction modes are described by way of example, but more or fewer directional intra prediction modes may be defined. The intra direction parameters of the current block may be determined based on a lookup table defining a mapping relationship between the directional intra prediction modes and the intra direction parameters. Alternatively, the intra direction parameters of the current block may be determined based on information signaled by a bitstream.
[0275] Depending on the directionality of the directional intra prediction mode, at least one of the left reference sample or the upper reference sample may be used to perform intra prediction of the current block. Here, the upper reference sample may be a reference sample having a y-axis coordinate smaller than the prediction target sample (x, 0) included in the upper row in the current block (e.g., (-1, -1) to (2W-1, -1)), and the left reference sample may be a reference sample having an x-axis coordinate smaller than the prediction target sample (0, y) included in the leftmost column in the current block (e.g., (-1, -1) to (-1, 2H-1)).
[0276] According to the directionality of the intra prediction mode, the reference samples of the current block may be rearranged in one dimension. Specifically, in the case where both the upper reference sample and the left reference sample should be used for intra prediction of the current block, it is assumed that both the upper reference sample and the left reference sample are arranged in a line in the vertical direction or the horizontal direction, and the reference sample of each prediction target sample may be selected.
[0277] For example, when the intra direction parameter is negative (eg, intra prediction modes corresponding to modes 11 to 25 in Table 3), the upper reference samples and the left reference samples may be rearranged horizontally or vertically to form a one-dimensional reference sample group P_ref_1D.
[0278] Fig.14 and Fig.15 is a diagram showing a one-dimensional reference sample group in which the reference samples are rearranged in a row.
[0279] Whether to rearrange the reference samples in the vertical direction or in the horizontal direction may be determined according to the directionality of the intra prediction mode. Fig.14 In the example shown, when the intra prediction mode is toward the left (e.g., in Fig. 9 In the example shown, the intra prediction mode index is between 11 and 18), the upper reference sample of the current block can be rotated counterclockwise to generate the following one-dimensional reference sample group, in which the left reference sample and the upper reference sample are arranged in the vertical direction.
[0280] On the other hand, Fig.15 In the example shown, when the intra prediction mode is toward the upper side (for example, in Fig. 9 In the example shown, the intra prediction mode index is between 19 and 25), the left reference sample of the current block can be rotated clockwise to generate the following one-dimensional reference sample group, in which the left reference sample and the upper reference sample are arranged in the horizontal direction.
[0281] If the intra-frame direction parameter of the current block is not negative, only the left reference sample or the upper reference sample can be used to perform intra-frame prediction of the current block. Therefore, for the intra-frame prediction mode whose intra-frame direction parameter is not negative, only the left reference sample or the upper reference sample can be used to reconstruct the one-dimensional reference sample group.
[0282] Based on the intra-frame direction parameter, a reference sample determination index iIdx may be derived, where the reference sample determination index iIdx is used to specify at least one reference sample for predicting a prediction target sample. In addition, a weight-related parameter i fact , weight-related parameter i fact For determining the weight applied to each reference sample based on the intra-frame direction parameter. For example, Formula 7 shows an example of deriving reference sample determination index and weight-related parameters.
[0283] [Formula 7]
[0284] iIdx=(y+1)*(P ang / 32)
[0285] ifact=[(y+1)*P ang ]31
[0286] As shown in Formula 7, iIdx and iIdx are variably determined according to the slope of the directional intra prediction mode. fact In this case, the reference sample specified by iIdx may correspond to an integer pixel.
[0287] Based on the reference sample determination index, at least one reference sample may be specified for each prediction sample. For example, the position of the reference sample in a one-dimensional reference sample group used to predict the prediction target sample in the current block may be specified based on the reference sample determination index. Based on the reference sample at the specified position, a prediction image (i.e., prediction sample) of the prediction target sample may be generated.
[0288] A prediction image of a prediction target sample may be generated based on one or more reference samples according to an intra prediction mode of a current block.
[0289] For example, when a virtual angle line extending from a prediction target sample passes through an integer pixel position in a one-dimensional reference sample group (i.e., a reference sample at an integer position), a prediction image of the prediction target sample can be generated by copying the reference sample at the integer pixel position or scaling the reference sample while considering the position between the reference sample at the integer pixel position and the prediction target sample. The virtual angle line may refer to a line extending in one direction or in two directions along the angle of the intra-prediction mode of the current block or the slope of the intra-prediction mode. As an example, the following formula 8 shows an example of generating a prediction image P(x, y) of a prediction target sample at a position (x, y) by copying a reference sample P_ref_1D(x+iIdx+1) specified by the intra-prediction mode of the current block.
[0290] [Formula 8]
[0291] P(x, y) = P_ref_1D(x+iIdx+1)
[0292] On the other hand, when the virtual angle line extending from the prediction target sample does not pass through the integer pixel position, a plurality of reference samples can be used to obtain a predicted image of the prediction target sample. The predicted image of the prediction target sample can be generated by linearly interpolating a reference sample adjacent to the position where the virtual angle line passes and at least one adjacent reference sample adjacent to the reference sample. Alternatively, the predicted image of the prediction target sample can be obtained by performing a tap filter-based interpolation on the reference sample and at least one adjacent reference sample. The number of taps of the interpolation filter can be a natural number of 2 or greater. Specifically, depending on the number of reference samples to be interpolated, the number of taps of the tap filter can be an integer of 2, 3, 4, 5, 6 or more.
[0293] As an example, when a virtual angle line extending from a prediction target sample passes between two integer pixel positions, a prediction image of the prediction target sample can be generated by using at least one of the reference samples at the two positions where the virtual angle line passes or the reference samples at the two integer pixel positions and at least one adjacent reference sample. Here, the adjacent reference sample may include at least one of the reference samples adjacent to the left / right side or the upper / lower side of the reference sample. As an example, the following formula 9 shows an example of generating a prediction sample P(x, y) of a prediction target sample by interpolating two or more reference samples.
[0294] [Formula 9]
[0295] P(x, y) = (32-i fact ) / 32*P_ref_1D(x+iIdx+1)+i fact / 32*P_ref_1D(x+iIdx+2)
[0296] The coefficients of the interpolation filter may be determined based on the weight-related parameters ifact. As an example, the coefficients of the interpolation filter may be determined based on the distance between the integer pixels (ie, the integer position of each reference sample) located on the corner line and the fractional pixels.
[0297] The following formula 10 shows a case where the number of taps of the tap filter is 4.
[0298] [Formula 10]
[0299] P(x,y)-f(0)*P_ref_1D(x+iIdx-1)+f(1)*P_ref_1D(x+iIdx)+f(2)*P_ref_1D(x+iIdx+1)+f(3)*P_ref_1D(x+iIdx-2)
[0300] As in the example shown in Formula 10, a predicted image of a predicted target sample can be obtained by interpolating a plurality of continuous reference samples. In this case, when at least one of the N continuous reference samples is not included in the one-dimensional reference sample group, the value of the reference sample can be replaced with a predefined value or a value of an adjacent reference sample. As an example, when a sample at a position (x+iIdx-1) is not included in the one-dimensional reference sample group, the reference sample value at the position can be replaced with a predefined value or a value of an adjacent reference sample (e.g., P_ref_1D(x+iIdx)). Alternatively, when a sample at a position (x+iIdx+2) is not included in the one-dimensional reference sample group, the reference sample value at the position can be replaced with a predefined value, a precalculated value, or a value of an adjacent reference sample (e.g., P_ref(x+iIdx+1)). Here, the predefined value may be an integer including 0. The precalculated value may be a value determined by the bit depth. Alternatively, the predefined value may be calculated based on an average value, a minimum value, or a maximum value of at least one reference sample.
[0301] The multi-tap filter may have a straight shape. As an example, a straight multi-tap filter using a plurality of continuous reference samples in the horizontal direction or the vertical direction may be applied. Alternatively, the multi-tap filter may have a polygonal shape such as a square or a cross. As an example, a cross-shaped multi-tap filter may be used, which uses a reference sample and reference samples adjacent to all four sides of the reference sample. The shape of the multi-tap filter may be variably determined based on the size, shape, or intra-prediction mode of the current block.
[0302] As shown in Formulas 8 to 10, generating a prediction sample by interpolating a reference sample using the directionality of intra prediction may be referred to as an intra prediction sample interpolation technique.
[0303] When using intra-frame prediction sample interpolation technology, a large number of tap numbers of tap filters do not necessarily guarantee an improvement in prediction accuracy. For example, in the case where the size of the current block is an asymmetric coding unit such as 2x16 or a small-size block such as 4x4 in which one of the height or width is significantly larger than the other, the use of a tap filter with 4 or more taps may result in excessive smoothing of the predicted image. Therefore, the type of the tap filter can be adaptively determined according to the size, shape or intra-frame prediction mode of the current block. Here, the type of the tap filter can be defined by at least one of the number of taps, filter coefficients, filter strength (strong / weak), filtering direction or filter type. The number of filter taps or filter coefficients can be variably determined according to the filter strength. In addition, according to the type of the tap filter, the application direction of the tap filter can be determined, such as horizontal interpolation, vertical interpolation or horizontal and vertical interpolation. The application direction of the tap filter can be variably set in units of lines (rows or columns) or samples in the current block.
[0304] Specifically, the type of tap filter to be used can be determined based on the width or height of the current block. For example, when at least one of the width or height of the current block is less than a predetermined value, the intra-frame prediction sample interpolation technique can be performed by using a 2-tap filter instead of a 4-tap filter. On the other hand, when both the width and height of the current block are greater than or equal to a predetermined value, a 4-tap filter can be used to perform the intra-frame prediction sample interpolation technique. Here, the predefined value can represent a value such as 4, 8, or 16.
[0305] Alternatively, the type of tap filter to be used may be determined according to whether the width and height of the current block are the same. For example, in the case where the width and height of the current block are different values, a 2-tap filter may be used instead of a 4-tap filter to perform the intra-frame prediction sample interpolation technique. On the other hand, in the case where the width and height of the current block have the same value, a 4-tap filter may be used to perform the intra-frame prediction sample interpolation technique.
[0306] Alternatively, the type of tap filter to be used may be determined based on the ratio of the width and height of the current block. For example, when the ratio of the width (w) to the height (h) of the current block (i.e., w / h or h / w) is less than a predefined threshold, a 2-tap filter may be used instead of a 4-tap filter to perform the intra-frame prediction sample interpolation technique; on the other hand, when the ratio of the width and height of the current block is greater than or equal to the predefined threshold, a 4-tap filter may be used to perform the intra-frame prediction sample interpolation technique.
[0307] Alternatively, the type of the tap filter can be determined according to the intra-frame prediction mode, shape or size of the current block. For example, when the current block is a 2x16 type coding unit and the intra-frame prediction mode of the current block is an intra-frame prediction mode belonging to the horizontal range, a tap filter with a tap number of n can be used to perform the intra-frame prediction sample interpolation technology. On the other hand, when the current block is a 2x16 type coding unit and the intra-frame prediction mode of the current block is an intra-frame prediction mode belonging to the vertical direction range, a tap filter with a tap number of m can be used to perform the intra-frame prediction sample interpolation technology.
[0308] On the other hand, when the current block is a 16x2 type coding unit and the intra-frame prediction mode of the current block is an intra-frame prediction mode belonging to the horizontal direction range, a tap filter with a tap number of n can be used to perform the intra-frame prediction sample interpolation technology. On the other hand, when the current block is a 16x2 type coding unit and the intra-frame prediction mode of the current block is an intra-frame prediction mode belonging to the vertical direction range, a tap filter with a tap number of m can be used to perform the intra-frame prediction sample interpolation technology.
[0309] Here, the horizontal range may indicate a predetermined range including intra prediction modes in the horizontal direction, and the vertical range may indicate a predetermined range including intra prediction modes in the vertical direction. For example, based on 35 intra prediction modes, the horizontal direction range may indicate an intra prediction mode between mode 11 and mode 18, and the vertical direction range may indicate an intra prediction mode between mode 19 and mode 27.
[0310] In addition, n and m are constants greater than 0, and n and m may have different values. Alternatively, n and m may be set to have the same value, but at least one of the filter coefficients or filter strengths of the n-tap filter and the m-tap filter may be set differently.
[0311] When using the directional prediction mode or the DC mode, there may be a problem that image quality degradation occurs at the block boundary. On the other hand, in the planar mode, image quality degradation at the block boundary is relatively small compared to those prediction modes.
[0312] The planar mode-based intra prediction may be performed by generating a first predicted image in a horizontal direction and a second predicted image in a vertical direction by using a reference sample and then performing weighted prediction of the first predicted image and the second predicted image.
[0313] Here, the first predicted image may be generated based on the reference samples placed in the horizontal direction of the prediction target sample. As an example, the first predicted image may be generated based on the weighted sum of the reference samples placed in the horizontal direction of the prediction target sample. In this case, the weight applied to each reference sample may be determined in consideration of the distance from the prediction target sample or the size of the current block. The samples placed in the horizontal direction may include a left reference sample on the same horizontal line as the prediction target sample (that is, a left reference sample having the same y coordinate as the prediction target sample) and a right reference sample on the same horizontal line as the prediction target sample (that is, a right reference sample having the same y coordinate as the prediction target sample). In this case, the right reference sample may be derived from the upper reference sample of the current block. For example, the right reference sample may be derived by copying the value of the upper reference sample placed on the same vertical line as the right reference sample, or the right reference sample may be derived as a weighted sum or average of multiple upper reference samples. Herein, the upper reference sample placed on the same vertical line as the right reference sample may include a reference sample adjacent to the upper right corner of the current block (that is, an upper reference sample having the same x coordinate as the right reference sample). Alternatively, the position of the upper reference sample used to derive the right reference sample may be determined differently according to the shape, size, or position of the prediction target sample of the current block.
[0314] The second predicted image may be generated based on the reference samples placed in the vertical direction of the prediction target sample. As an example, the second predicted image may be generated based on the weighted sum of the reference samples placed in the vertical direction of the prediction target sample. In this case, the weight applied to each reference sample may be determined in consideration of the distance from the prediction target sample or the size of the current block. The samples placed in the vertical direction may include an upper reference sample on the same vertical line as the prediction target sample (that is, an upper reference sample with the same x coordinate as the prediction target sample) and a lower reference sample on the same vertical line as the prediction target sample (that is, a lower reference sample with the same x coordinate as the prediction target sample). In this case, the lower reference sample may be derived from the left reference sample of the current block. For example, the lower reference sample may be derived by copying the value of the left reference sample placed on the same horizontal line as the lower reference sample, or the lower reference sample may be derived as a weighted sum or average of multiple left reference samples. Herein, the left reference sample placed on the same horizontal line as the lower reference sample may include a reference sample adjacent to the lower left corner of the current block (that is, a left reference sample with the same y coordinate as the lower reference sample). Alternatively, the position of the upper reference sample used to derive the lower reference sample may be determined differently according to the shape, size, or position of the prediction target sample of the current block.
[0315] Alternatively, both the left reference sample and the upper reference sample may be used to derive at least one of the right reference sample or the lower reference sample.
[0316] As an example, a weighted sum or an average value of the upper reference sample and the left reference sample of the current block may be determined as the value of at least one of the right reference sample or the lower reference sample.
[0317] Alternatively, the lower left reference sample and the upper right reference sample may be used to derive a lower right reference sample adjacent to the lower right corner of the current block, and the derived lower right reference sample may then be used to derive the right reference sample and the lower reference sample. The lower right reference sample may be derived based on a weighted sum or average of the upper right reference sample and the left reference sample of the current block. In this case, the weights applied to the upper right reference sample and the left reference sample may have the same value, or may be determined based on the width / height of the current block.
[0318] Once the lower right reference sample is determined, the right reference sample can be derived by interpolating the lower right reference sample and the upper right reference sample, and the lower reference sample can be derived by interpolating the lower right reference sample and the lower left reference sample. In this case, the coefficient of the interpolation filter can be determined based on the size of the current block, the shape of the current block, the distance to the lower right reference sample, the distance to the upper right reference sample, or the distance to the lower left reference sample.
[0319] In order to derive the right reference sample or the left reference sample, a reference sample of a fixed position may be used, or a reference sample adaptively selected according to the position of the prediction target sample may be used. For example, the right reference sample may be derived by using an upper right reference sample that is independent of the position of the prediction target sample, or the right reference sample may be derived by using a left reference sample selected according to the position of the prediction target sample (e.g., a reference sample having the same y-axis coordinate as the prediction target sample) or an upper reference sample selected according to the position of the prediction target sample (e.g., a reference sample having the same x-axis coordinate as the prediction target sample). Alternatively, the lower reference sample may be derived using a lower left reference sample (regardless of the position of the prediction target sample), or the lower reference sample may be derived using a left reference sample selected according to the position of the prediction target sample (e.g., a reference sample having the same y-axis coordinate as the prediction target sample) or an upper reference sample selected according to the position of the prediction target sample (e.g., a reference sample having the same x-axis coordinate as the prediction target sample).
[0320] Fig.16 is a diagram showing an example of deriving a right reference sample or a lower reference sample using a plurality of reference samples. It is assumed that a current block is a block having a size of W×H.
[0321] Reference Fig.16 (a), first, based on the weighted sum or average of the upper right reference sample P (W, -1) and the lower left sample P (-1, H) of the current block, the lower right reference sample P (W, H) can be generated. In this case, the weights applied to the upper right reference sample and the left reference sample can be set equally or the weights applied to the upper right reference sample and the left reference sample can be determined based on the width W and height H of the current block. For example, when the current block is non-square, the weight applied to the upper right reference sample can be determined as W / (W+H), and the weight applied to the lower left reference sample can be determined as H / (W+H).
[0322] In addition, a right reference sample P(W, y) for predicting the target sample (x, y) may be generated based on the lower right reference sample P(W, H) and the upper right reference sample P(W, -1). For example, the right prediction sample P(W, y) may be calculated as a weighted sum or average value of the lower right reference sample P(W, H) and the upper right reference sample P(W, -1). In addition, a lower reference sample P(x, H) for predicting the target sample (x, y) may be generated based on the lower right reference sample P(W, H) and the lower left reference sample P(-1, H). For example, the lower reference sample P(x, H) may be calculated as a weighted sum or average value of the lower right reference sample P(W, H) and the left reference sample P(-1, H).
[0323] like Fig.16 As shown in (b), when the right reference sample and the lower reference sample are generated, the first prediction sample Ph(x, y) and the second prediction sample Pv(x, y) can be generated by using the generated prediction samples. In this case, the first prediction sample Ph(x, y) can be generated based on the weighted sum of the left reference sample P(-1, y) and the right reference sample P(W, y), and the second prediction sample Pv(x, y) can be generated based on the weighted sum of the upper reference sample P(x, -1) and the lower reference sample P(x, H).
[0324] Fig.17 and Fig.18 is a diagram for explaining determination of right reference samples and lower reference samples for a non-square block according to an embodiment of the present invention.
[0325] As in Fig.17 In the example shown, when the current block is a (N / 2)×N non-square block, the right reference sample can be derived based on the upper right reference sample P(N / 2,-1), and the lower reference sample can be derived based on the lower left reference sample P(-1,N).
[0326] Alternatively, the right reference sample or the lower reference sample may be derived based on at least one of a weighted sum, an average value, a minimum value, or a maximum value of the upper right reference sample P(N / 2, -1) and the lower left reference sample P(-1, N). For example, the right reference sample may be derived based on a weighted sum or an average value of P(N / 2, -1) and P(-1, N), or the right reference sample may be derived by interpolating the lower right reference sample and the upper right reference sample. After the lower right reference sample P(N / 2, N) is derived based on P(N / 2, -1) and P(-1, N). Alternatively, the lower reference sample may be derived based on a weighted sum or an average value of P(N / 2, -1) and P(-1, N), or the lower reference sample may be derived by interpolating the lower right reference sample and the lower left reference sample after the lower right reference sample P(N / 2, N) is derived based on P(N / 2, -1) and P(-1, N).
[0327] On the other hand, Fig.18 In the example shown, when the current block is an Nx(N / 2) non-square block, the right reference sample can be derived based on the upper right reference sample P(N, -1), and the lower reference sample can be derived based on the lower left reference sample P(-1, N / 2).
[0328] Alternatively, the right reference sample or the lower reference sample may be derived based on at least one of a weighted sum, an average value, a minimum value, or a maximum value of the upper left reference sample P(N, -1) and the lower left reference sample P(-1, N / 2). For example, the right reference sample may be derived based on a weighted sum or an average value of P(N, -1) and P(-1, N / 2), or the right reference sample may be derived by interpolating the lower right reference sample and the upper right reference sample after deriving the lower right reference sample P(N, N / 2) based on P(N, -1) and P(-1, N / 2). Alternatively, the lower reference sample may be derived based on a weighted sum or an average value of P(N, -1) and P(-1, N / 2), or the lower reference sample may be derived by interpolating the lower right reference sample and the lower left reference sample after deriving the lower right reference sample P(N, N / 2) based on P(N, -1) and P(-1, N / 2).
[0329] In reference Figures 16 to 18In the described example, the lower reference sample may be derived based on at least one of the lower left reference sample of the current block placed on the same horizontal line as the lower reference sample or the upper right reference sample of the current block placed on the same vertical line as the right reference sample, and the right reference sample may be derived based on at least one of the upper right reference sample of the current block placed on the same vertical line as the right reference sample or the lower left reference sample of the current block placed on the same horizontal line as the lower reference sample. Unlike the described example, the right reference sample or the left reference sample may be derived based on at least one of the upper center reference sample or the left center reference sample. For example, after the lower center sample is derived using the upper center sample and the lower left reference sample, the lower sample may be generated by interpolation or extrapolation of the lower center sample and the lower left sample. In addition, after the right center sample is derived by using the left center sample and the upper right sample, the lower sample may be generated by interpolation or extrapolation of the right center sample and the upper right sample.
[0330] The positions of the reference samples used to generate the first predicted image and the second predicted image may be determined differently according to the size or shape of the current block. For example, the positions of the upper reference samples or the left reference samples used to derive the right reference samples or the lower reference samples may be determined differently according to the size or shape of the current block.
[0331] As an example, when the current block is a square block of N×N size, the right reference sample may be derived based on the upper right reference sample P(N,-1), and the lower reference sample may be derived based on the lower left reference sample P(-1,N). Alternatively, when the current block is a square block of N×N size, the right reference sample and the lower reference sample may be derived based on at least one of the weighted sum, average value, minimum value, or maximum value of the upper right reference sample P(N,-1) and the lower left reference sample P(-1,N).
[0332] On the other hand, when the current block is a non-square block of Nx2 / N size, the lower center reference sample P(N / 2, N / 2) may be derived based on the upper center reference sample P(N / 2, -1) and the lower left reference sample P(-1, N / 2), and then the lower reference sample may be derived based on the derived lower center reference sample. For example, the lower reference sample may be derived by interpolation or extrapolation of the lower center reference sample and the lower left reference sample. Alternatively, when the current block is a non-square block of N / 2×N size, the right center reference sample P(N / 2, N / 2) may be derived based on the upper right reference sample P(N / 2, -1) and the left center reference sample P(-1, N / 2), and then the right reference sample may be derived based on the derived right center reference sample. For example, the right reference sample may be derived by interpolation or extrapolation of the right center reference sample and the upper right reference sample.
[0333] The first predicted image may be calculated based on weighted prediction of reference samples disposed on the same horizontal line as the prediction target sample. Likewise, the second predicted image may be calculated based on weighted prediction of reference samples disposed on the same vertical line as the prediction target sample.
[0334] In addition to the above examples, the first predicted image or the second predicted image may be generated using an average value, a minimum value, or a maximum value of the reference samples.
[0335] The method of deriving the reference sample may be set differently, or the method of deriving the first prediction image or the second prediction may be set differently, depending on whether the prediction target sample is included in a predetermined area of the current block, the size or shape of the current block, etc. Specifically, the number of reference samples or the position of the reference samples used to derive the right reference sample or the lower reference sample may be determined differently, or the weight or number of reference samples used to derive the first prediction image or the second prediction image may be set differently, depending on the position of the prediction target sample.
[0336] For example, the right side reference sample for generating the first prediction image of the prediction target sample included in the predetermined area can be derived using only the upper side reference sample, and the right side reference sample for generating the first prediction image of the prediction target sample included outside the predetermined area can be derived based on the weighted sum or average value of the upper side reference sample and the left side reference sample.
[0337] For example, Fig.17 In the example shown, when the current block is a non-square block with a height greater than a width, a right reference sample of a prediction target sample at a position (x, y) in a predetermined area included in the current block can be derived from P(N / 2, -1). For example, the right reference sample of the prediction target sample included in the predetermined area can be generated by copying the value of the reference sample P(N / 2, -1). On the other hand, the right reference sample of the prediction target sample at a position (x', y') outside the predetermined area included in the current block can be derived based on a weighted sum or average of P(N / 2, -1) and P(-1, N). For example, the right reference sample of the prediction target sample outside the predetermined area can be generated by interpolating the lower right reference sample P(N / 2, N) and the upper right reference sample P(N / 2, -1) derived based on P(N / 2, -1) and P(-1, N).
[0338] Alternatively, for example, Fig.18In the example shown, when the current block is a non-square block with a width greater than a height, a lower reference sample of a prediction target sample at a position (x, y) in a predetermined area included in the current block can be derived from P(-1, N / 2). For example, the lower reference sample of the prediction target sample included in the predetermined area can be generated by copying the value of the reference sample P(-1, N / 2). On the other hand, the lower reference sample of the prediction target sample at a position (x', y') outside the predetermined area included in the current block can be derived based on a weighted sum or average of P(N, -1) and P(-1, N / 2). For example, the lower reference sample of the prediction target sample outside the predetermined area can be generated by interpolating the lower right reference sample P(N, N / 2) and the lower left reference sample P(-1, N / 2) derived based on P(N, -1) and P(-1, N / 2).
[0339] As another example, a first prediction image or a second prediction image of a prediction target sample included in a predetermined area may be generated based on a weighted sum of reference samples, and a first prediction image or a second prediction image of a prediction target sample outside the predetermined area may be generated using an average value, a minimum value, or a maximum value of the reference samples or using only one reference sample having a predefined position among the reference samples. Fig.17 In the example shown, when the current block is a non-square block with a height greater than a width, only one of the right reference sample P(N / 2, y) derived from P(N / 2, -1) and the left reference sample at the position P(-1, y) may be used to generate a first predicted image of a predicted target sample at a position (x, y) included in a predetermined region of the current block. On the other hand, a first predicted image of a predicted target sample at a position (x', y') not included in the predetermined region may be generated based on a weighted sum or average of the right reference sample P(N / 2, -1) derived from P(N / 2, -1) and the reference sample at the position of P(1, y').
[0340] Alternatively, if Fig.18 In the example shown, when the current block is a non-square block having a width greater than a height, only one of the lower reference sample P(x, N / 2) derived from P(-1, N / 2) or the upper reference sample at the position P(x, -1) may be used to generate a second predicted image of a predicted target sample at the position (x, y) included in a predetermined region of the current block. On the other hand, a second predicted image of a predicted target sample at the position (x', y') not included in the predetermined region may be generated based on a weighted sum or average of the lower reference sample P(x', N / 2) derived from P(-1, N / 2) and the reference sample at the position P(1, y').
[0341] In the above-mentioned embodiment, the predetermined area may be at least one sample line adjacent to the boundary of the current block or one of the remaining areas other than the sample line. Herein, the boundary of the current block may include at least one of a left boundary, a right boundary, an upper boundary or a lower boundary. In addition, the number or position of the boundaries for defining the predetermined area may be set differently according to the shape of the current block. Alternatively, the predetermined area may be the shape of a block adjacent to one corner of the current block. In this case, the size and shape of the predetermined area may be determined based on at least one of the size or shape of the current block.
[0342] In the planar mode, the final predicted image may be derived based on a weighted sum, an average value, a minimum value, or a maximum value of the first predicted image and the second predicted image.
[0343] For example, the following formula 11 shows an example of generating a final predicted image P based on a weighted sum of a first predicted image Ph and a second predicted image Pv.
[0344] [Formula 11]
[0345] P(x,y)=(w*P h (x,y)+(1-w)*P v (x, y)+N)>>(log2(N)+1)
[0346] In Formula 11, the prediction weight w may be different according to the shape, size, or position of the prediction target sample of the current block.
[0347] As an example, the prediction weight w may be derived in consideration of the width of the current block, the height of the current block, the ratio of the width to the height, etc. When the current block is a non-square block having a width greater than the height, w may be set to apply a higher weight to the first prediction image. On the other hand, when the current block is a non-square block having a height greater than the width, w may be set to apply a higher weight to the second prediction image.
[0348] As an example, when the current block is a square, the prediction weight w may have a value of 1 / 2. On the other hand, when the current block is a non-square block with a height greater than a width (e.g., (N / 2)×N), the prediction weight w may be set to 1 / 4. In addition, when the current block is a non-square block with a width greater than a height (e.g., Nx(N / 2)), the prediction weight w may be set to 3 / 4.
[0349] In addition to the planar mode, intra-frame prediction based on the DC mode or the directional intra-frame prediction mode can also be performed by using reference samples other than the left reference samples and the upper reference samples. In the following embodiments, the left reference samples and the upper reference samples will be referred to as first reference samples, and the reference samples other than the left reference samples and the upper reference samples will be referred to as second reference samples. As an example, the second reference sample may include a right reference sample and / or a lower reference sample of the current block. Herein, the lower reference sample may refer to a reference sample having a y-axis coordinate larger than the predicted target sample of the lower row in the current block, and the right reference sample may refer to a reference sample having an x-axis coordinate larger than the predicted target sample of the rightmost column in the current block.
[0350] Whether to perform intra prediction using the second reference sample may be determined based on at least one of the size, shape, or intra prediction mode of the current block or the position of the prediction target sample. For example, whether to perform intra prediction using the second reference sample may be determined based on whether the intra prediction mode of the current block is a vertical mode, a horizontal mode, or a diagonal mode. Alternatively, intra prediction of the prediction target sample included in the predetermined area of the current block is performed by using the second reference sample, and intra prediction of the prediction target sample not included in the predetermined area of the current block is performed by using the first reference sample.
[0351] Alternatively, information indicating whether to use the second reference sample may be signaled through a bitstream. The information may be a 1-bit flag, an index for determining the intra prediction mode of the current block, and the like.
[0352] Alternatively, whether to use the second reference sample may be determined based on whether the second reference sample is used in a neighboring block of the current block.
[0353] The second reference sample may be generated based on the first reference sample. As an example, the second reference sample may be configured by changing the order of the first reference sample, or the second reference sample may be derived using the first reference sample at a specific position.
[0354] Fig.19 is a diagram for explaining an example of deriving a second reference sample using a first reference sample.
[0355] First, a lower right reference sample P(W, H) derived based on the upper right reference sample r(W, -1) and the lower left reference sample r(-1, H) of the current block may be derived. In detail, the lower right reference sample may be derived by a weighted sum or average of the upper right reference sample and the lower left reference sample. Formula 12 shows an example of deriving the lower right reference sample.
[0356] [Formula 12]
[0357]
[0358] As shown in Formula 12, the lower right reference sample can be calculated based on the weighted sum between the upper right reference sample and the lower left reference sample. In this case, the weights applied to the upper right reference sample and the lower left reference sample can be determined according to the width and height of the current block. For example, when the current block is a square, the same weight is applied to the upper right reference sample and the lower left reference sample. On the contrary, when the current block is a non-square, different weights can be applied to the upper right reference sample and the lower left reference sample. However, the weight setting method shown in Formula 12 is only an example of the present invention, and the present invention is not limited to this. In addition to the example shown in Formula 12, the weight can be determined based on at least one of the following: the size, shape or intra-frame prediction mode of the current block, the availability of reference samples, the availability of adjacent blocks, whether the adjacent blocks are encoded in intra-frame prediction mode or the intra-frame prediction mode of the adjacent blocks.
[0359] The right reference sample can be derived based on the upper right reference sample and the lower right reference sample. For example, the right reference sample can be obtained by interpolating the upper right reference sample and the lower right reference sample. The following formula 13 shows an example of deriving the right reference sample.
[0360] [Formula 13]
[0361]
[0362] As shown in Formula 13, the right reference sample Pr(W, y) (where y is an integer between 0 and CU height (cu_height)) can be obtained by weighted prediction of the upper right reference sample r(W, -1) and the lower right reference sample P(W, H). In this case, the weights applied to the upper right reference sample and the lower right reference sample can be determined based on at least one of the width, height, or position of the right reference sample of the current block. For example, in the example shown in Formula 13, a weight of (H-1-y) / H is applied to the upper right reference sample, and a weight of (y+1) / H is applied to the lower right reference sample. However, the weight setting method shown in Formula 13 is only an example of the present invention, and the present invention is not limited thereto. In addition to the example shown in Formula 13, the weight can be determined based on at least one of the following: the size, shape, or intra-prediction mode of the current block, the availability of reference samples, the availability of adjacent blocks, whether the adjacent blocks are encoded in intra-prediction mode, or the intra-prediction mode of the adjacent blocks.
[0363] The lower reference sample may be derived based on the lower left reference sample and the lower right reference sample. As an example, the lower reference sample may be obtained by interpolating the lower left reference sample and the lower right reference sample. Formula 14 shows an example of deriving the lower reference sample.
[0364] [Formula 14]
[0365]
[0366] As shown in Formula 14, the lower reference sample Pb(x, H) (where x is an integer between 0 and the CU width (cu_width)) can be obtained by weighted prediction of the lower left reference sample r(-1, H) and the lower right reference sample P(W, H). In this case, the weights applied to the lower left reference sample and the lower right reference sample can be determined based on at least one of the width, height, or position of the lower reference sample of the current block. For example, as shown in the example of Formula 14, a weight of (W-1-x) / W is applied to the lower left reference sample, and a weight of (x+1) / H is applied to the lower right reference sample. However, the weight setting method shown in Formula 14 is only an example of the present invention, and the present invention is not limited thereto. In addition to the example shown in Formula 14, the weight can be determined based on at least one of the following: the size, shape, or intra-prediction mode of the current block, the availability of reference samples, the availability of adjacent blocks, whether the adjacent blocks are encoded in intra-prediction mode, or the intra-prediction mode of the adjacent blocks.
[0367] When the current block is non-square, you can refer to the above Fig.17 and Fig.18 An example is described to derive the right reference sample and the lower reference sample.
[0368] As in the above example, the first reference sample at a fixed position, such as the upper right reference sample and the lower left reference sample, can be used to derive the second reference sample, such as the right reference sample and the lower reference sample. Unlike the above example, the second reference sample can be derived using the first reference sample at a different position from the upper right reference sample and / or the upper left reference sample. For example, the right reference sample and the lower reference sample can be derived by using the first reference sample, such as the upper center reference sample of the current block or the left center sample of the current block.
[0369] Alternatively, the first reference sample used to derive the second reference sample may be determined according to the intra prediction mode of the current block. As an example, the right reference sample and / or the lower reference sample may be derived based on the left reference sample and / or the upper reference sample specified by the directionality of the intra prediction mode of the current block.
[0370] Alternatively, the second reference sample may be determined using a plurality of left reference samples and / or a plurality of upper reference samples. For example, at least one of the right reference sample, the lower reference sample, or the lower right reference sample may be generated based on a weighted sum, an average value, a maximum value, or a minimum value of a plurality of left reference samples or a weighted sum, an average value, a maximum value, or a minimum value of a plurality of upper reference samples.
[0371] Alternatively, the second reference sample can be generated by copying the first reference sample. In this case, the first reference sample used to generate the second reference sample can have a fixed position, or can be adaptively determined according to the size, shape or intra prediction mode of the current block or the position of the second reference sample.
[0372] In the above example, although it is shown as having W lower reference samples and H right reference samples, a greater number of lower reference samples and / or right reference samples may be derived. For example, the lower reference samples may be derived to the same vertical line as the rightmost upper reference sample r(2W-1, -1), or the right reference samples may be derived to the same horizontal line as the lowest left reference sample r(-1, 2H-1).
[0373] In this case, the lower reference sample having an x coordinate greater than w may be generated by extrapolating the lower left reference sample and the lower right reference sample, or may be generated by interpolating the lower right reference sample P(W, H) and the rightmost lower reference sample P(2W-1, H). The rightmost lower reference sample may be generated by copying the rightmost upper reference sample r(2W-1, -1), or may be generated by a weighted sum operation between the rightmost upper reference sample and the lower left reference sample. The right reference sample having a y coordinate greater than H may be generated by extrapolating the upper right reference sample and the lower right reference sample, or may be generated by interpolating the lower right reference sample P(W, H) and the lowest right reference sample P(W, 2H-1). In this case, the lowest right reference sample may be generated by copying the lowest left reference sample r(-1, 2H-1), or may be generated by a weighted sum operation between the lowest left reference sample and the upper left reference sample.
[0374] The first reference samples may be arranged in one dimension to generate a first one-dimensional reference sample group, and the second reference samples may be arranged in one dimension to generate a second one-dimensional reference sample group. In this case, the first one-dimensional reference sample group may be configured to include not only the first reference samples but also at least one or more second reference samples, and the second one-dimensional reference sample group may be configured to include not only the second reference samples but also at least one or more first reference samples.
[0375] Fig. 20 is a diagram showing reference samples constituting a one-dimensional reference sample group.
[0376] like Fig. 20 In the example shown in (a), the first one-dimensional reference sample group may consist of left reference samples and top reference samples of the current block.
[0377] On the other hand, Fig. 20 In the example shown in (b), the second one-dimensional reference sample group may be configured to include not only right reference samples and lower reference samples of the current block, but also some left reference samples and some upper reference samples.
[0378] That is, the lower left reference sample r(-1, H) and the left reference sample having a larger y-axis coordinate than the lower left reference sample among the left reference samples may be included in both the first one-dimensional reference sample group and the second one-dimensional reference sample group. In addition, the upper reference sample r(W, -1) and the upper reference sample having a larger x-axis coordinate than the upper right reference sample among the upper reference samples may be included in the first one-dimensional reference sample group and the second one-dimensional reference sample group.
[0379] Alternatively, based on at least one of the size, shape, or intra prediction mode of the current block, a portion of the first reference sample may be included only in the first one-dimensional reference sample group, or a portion of the first reference sample may be included only in the second one-dimensional reference sample group. In addition to the configuration of the one-dimensional reference sample group, the arrangement order of the reference samples constituting the one-dimensional reference sample group may be variably determined based on at least one of the size, shape, or intra prediction mode of the current block.
[0380] For ease of description, in the embodiments described below, a reference sample group including a left reference sample and an upper reference sample of a current block will be referred to as a first reference sample group (e.g., a first one-dimensional reference sample group), and a reference sample group including a right reference sample and a lower reference sample of a current block will be referred to as a second reference sample group (e.g., a second one-dimensional reference sample group). For example, the first reference sample group and the second reference sample group may be classified according to whether the right reference sample and the lower reference sample are included. In addition, in order to perform intra-frame prediction of a prediction target sample, a reference sample selected from the first reference sample group will be referred to as a first basic reference sample, and a reference sample selected from the second reference sample group will be referred to as a second basic reference sample.
[0381] Intra-frame prediction of the current block may be performed using at least one of the first reference sample group or the second reference sample group. For example, a prediction value of a prediction target sample in the current block may be obtained based on at least one of a first basic reference sample selected from the first reference sample group or a second basic reference sample selected from the second reference sample group. In this case, the first basic reference sample and / or the second basic reference sample may be determined based on at least one of a shape, a size, or an intra-frame prediction mode of the current block. For example, when the intra-frame prediction mode of the current block is determined, a first basic reference sample of the prediction target sample may be specified according to the direction of the determined intra-frame prediction mode, and a second basic reference sample of the prediction target sample may be specified according to the opposite direction of the determined intra-frame prediction mode.
[0382] Alternatively, the position of the second basic reference sample may be determined based on the position of the first basic reference sample, or the position of the first basic reference sample may be determined based on the position of the second basic reference sample. For example, a second basic reference sample having the same x-coordinate or the same y-coordinate as the first basic reference sample may be selected, or a second basic reference sample having a position derived by adding an offset to the x-coordinate or y-coordinate of the first basic reference sample may be selected. Herein, the offset may have a fixed value or may be adaptively determined according to the size, shape, or intra-prediction mode of the current block.
[0383] Alternatively, the position of the first basic reference sample and / or the second basic reference sample may be determined based on the position of the prediction target sample. For example, the first basic reference sample and / or the second basic reference sample having the same x-coordinate or the same y-coordinate as the prediction target sample may be selected, or the first basic reference sample and / or the second basic reference sample having a position obtained by adding an offset to the x-coordinate or y-coordinate of the prediction target sample may be selected. Herein, the offset may have a fixed value or may be adaptively determined according to the size, shape, or intra-prediction mode of the current block.
[0384] The prediction value of the prediction target sample may be generated based on at least one of the first prediction image according to the first basic reference sample or the second prediction image according to the second basic reference sample. In this case, the first prediction image may be generated based on the above description through the above formulas 8 to 10.
[0385] The second predicted image may be generated by interpolating or copying the second basic reference sample specified according to the slope of the intra prediction mode of the current block. For example, Formula 15 is a diagram showing an example of deriving the second predicted image by copying the second basic reference sample.
[0386] [Formula 15]
[0387] P2 (x, y)=P_2ns_1D(x+iIdx+1+f)
[0388] In Formula 15, P2(x, y) represents the second predicted image, and P_2nd_1D(x+iIdx+1+f) represents the second basic reference sample.
[0389] When only one second basic reference sample cannot represent the slope of the intra-frame prediction mode of the current block, a second predicted image can be generated by interpolating multiple second basic reference samples. Specifically, when an imaginary angle line following the slope and / or angle of the intra-frame prediction mode does not pass through an integer pixel (i.e., a reference sample at an integer position), the second predicted image can be obtained by interpolating the second reference samples adjacent to the left and right sides or the upper and lower sides of the angle line. For example, Formula 16 shows an example of obtaining a second predicted image by interpolating the second reference samples.
[0390] [Formula 16]
[0391]
[0392] The coefficients of the interpolation filter may be determined based on the weight-related parameters ifact.As an example, the coefficients of the interpolation filter may be determined based on the distance between the fractional pixels and the integer pixels (ie, the integer position of each reference sample) located on the corner line.
[0393] In Formula 16, the use of an interpolation filter having a tap number of 2 is shown, but an interpolation filter having a tap number greater than 2 may be used instead.
[0394] The final predicted image of the predicted target sample can be obtained based on at least one of the first predicted image or the second predicted image. For example, the first predicted image can be determined as the final predicted image of the predicted target sample, or the second predicted image can be determined as the final predicted image of the predicted target sample. Alternatively, the final predicted image of the predicted target sample can be determined based on a weighted sum or average of the first predicted image and the second predicted image. Formula 17 shows an example of obtaining the final predicted sample based on a weighted operation of the first predicted image and the second predicted image.
[0395] [Formula 17]
[0396] P(x, y) = w(x, y) × P 1 (x, y) + (1-w(x, y)) × P 2 (x, y)
[0397] In Formula 17, Pl(x, y) represents the first predicted image, and P2(x, y) represents the second predicted image. In addition, w(x, y) represents the weight applied to the first predicted image.
[0398] The weights assigned to the first predicted image and the second predicted image may be determined based on the position of the predicted target sample or at least one of the size, shape, or intra prediction mode of the current block. For example, Formula 18 shows an example of determining the weights based on the size of the current block and the position of the predicted target sample.
[0399] [Formula 18]
[0400]
[0401] In Formula 18, W and H represent the width and height of the current block, respectively, and (x, y) represents the coordinates of the predicted target sample.
[0402] As shown in Formula 18, as the prediction target sample is closer to the upper left corner of the current block, the weight to be applied to the first prediction image can be increased. In addition, as the prediction target sample is closer to the lower right corner of the current block, the weight applied to the second prediction image can be increased.
[0403] Alternatively, the weights may be derived based on neighboring blocks of the current block. Herein, the neighboring blocks of the current block may include at least one of an upper neighboring block, a left neighboring block, or a neighboring block adjacent to a corner of the current block (e.g., an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block).
[0404] Alternatively, information for determining the weight may be signaled via a bitstream. The information may indicate a weight value applied to the first predicted image or the second predicted image, or may indicate a weight difference between the current block and a neighboring block.
[0405] As in the above example, obtaining a final predicted image through a weighted sum operation between a first predicted image and a second predicted image may be referred to as bidirectional intra prediction (or dual intra prediction).
[0406] Dual intra prediction may be applied only to a partial area in the current block. In this case, the area to which dual intra prediction is applied may be predefined in the encoder and decoder. For example, dual intra prediction may be applied to a block of a predetermined size (e.g., 4×4) adjacent to the lower right corner of the current block. Alternatively, the area to which dual intra prediction is applied may be adaptively determined according to the size, shape, or intra prediction mode of the current block. Alternatively, information for determining the area to which dual intra prediction is applied (e.g., information indicating the size or position of the area) may be signaled via a bitstream.
[0407] Fig.21is a diagram showing an example of a region to which bidirectional intra prediction is applied.
[0408] In the area where bidirectional intra prediction is applied, the final prediction sample can be obtained by weighted prediction of the first prediction image and the second prediction image. On the other hand, in the area where bidirectional intra prediction is not applied, the first prediction image or the second prediction image can be determined as the final prediction sample.
[0409] The area to which the bidirectional intra prediction is applied may have a rectangular shape or a triangular shape.
[0410] In the above examples, it has been described that bidirectional intra prediction is performed using the first basic reference sample selected from the first sample group and the second basic reference sample selected from the second sample group. Different from the described examples, multiple reference samples may be selected from the first sample group to perform bidirectional intra prediction, or multiple reference samples may be selected from the second sample group to perform bidirectional intra prediction. For example, when the intra prediction mode of the current block has an upper right diagonal direction or a lower left diagonal direction, bidirectional intra prediction may be performed by selecting an upper reference sample and a left reference sample from the first sample group. That is, the final prediction sample of the current block may be obtained by weighted prediction of a first reference image obtained based on the upper reference sample and a second reference image obtained based on the lower reference sample.
[0411] Alternatively, according to the intra prediction mode, bidirectional intra prediction may be performed by selecting right reference samples and lower reference samples from the second sample group.
[0412] Bidirectional intra prediction can be defined as an independent intra prediction mode. For example, a total of 2N+2 intra prediction modes can be defined by defining N directional prediction modes and N bidirectional intra prediction modes corresponding to the N directional prediction modes. For example, by adding the bidirectional intra prediction mode to Fig. 9 The intra prediction modes shown in , a total of 68 intra prediction modes can be defined (that is, two non-directional intra prediction modes, 33 directional intra prediction modes and 33 bidirectional intra prediction modes). Of course, more or less than 33 directional intra prediction modes or more or less than 33 bidirectional intra prediction modes can also be used.
[0413] Alternatively, after determining the intra prediction mode of the current block, it can be determined whether to use the determined intra prediction mode to switch to the bidirectional prediction mode. For example, when determining the intra prediction mode of the current block, information about whether the determined intra prediction mode is used as the bidirectional intra prediction mode can be encoded. The information can be a 1-bit flag (e.g., bi_intra_flag), but is not limited to this. A value of bi_intra_flag of 0 indicates that directional intra prediction is performed, while a value of bi_intra_flag of 1 indicates that bidirectional intra prediction is performed. That is, when the value of bi_intra_flag is 0, the first predicted image is determined as the final predicted sample of the current block, and when the value of bi_intra_flag is 1, the weighted prediction of the first predicted image and the second predicted image can be determined as the final predicted sample of the current block.
[0414] Alternatively, whether the current block uses the bidirectional intra prediction mode may be determined based on whether the neighboring blocks adjacent to the current block use the bidirectional intra prediction mode. For example, when the intra prediction mode of the current block is the same as the candidate derived based on the intra prediction mode of the neighboring blocks (i.e., the MPM candidate), whether the bidirectional intra prediction mode is used for the current block may be determined in the same manner as whether the bidirectional intra prediction mode is used in the neighboring blocks.
[0415] Alternatively, whether to perform bidirectional intra prediction may be determined based on the size and / or shape of the current block. For example, bidirectional intra prediction is allowed only for blocks of 32×32 or larger. Therefore, when the size of the current block is less than 32×32, bidirectional intra prediction may not be applied, while when the size of the current block is 32×32, bidirectional intra prediction may be applied.
[0416] As another example, bidirectional intra prediction may be allowed only for square blocks, or may be allowed only for non-square blocks.
[0417] Alternatively, bidirectional intra prediction may be applied to only a portion of the directional intra prediction modes. Fig. 22 is an example of identifying and indicating a directional prediction mode that allows bidirectional intra prediction. Fig. 22 In the example shown, only a part of the intra prediction modes between the horizontal direction and the vertical direction allows bidirectional intra prediction. In this case, when the intra prediction mode is selected within the range, the bidirectional intra prediction may be performed by default, or whether the bidirectional intra prediction mode is performed may be determined based on information parsed through the bitstream or at least one of the size or shape of the current block when the intra prediction mode within the range is selected.
[0418] The intra prediction modes that allow bidirectional intra prediction are not limited to Fig. 22The example shown. The intra-frame prediction mode that allows bidirectional intra-frame prediction can be predefined in the encoder and the decoder, or the intra-frame prediction mode that allows bidirectional intra-frame prediction can be adaptively determined according to the size and / or shape of the current block. Alternatively, information for determining the intra-frame prediction mode that allows bidirectional intra-frame prediction can be sent by signaling through the bitstream.
[0419] Fig.23 is a flowchart illustrating a process of determining whether to apply a bidirectional intra prediction mode according to the present invention.
[0420] First, it may be determined whether the intra prediction mode of the current block is a non-directional mode (S2310). The non-directional mode may include at least one of planar and DC.
[0421] Information indicating whether the intra-frame prediction mode of the current block is a non-directional mode may be signaled through the bitstream. For example, at least one of a flag indicating whether the intra-frame prediction mode of the current block is a non-directional mode, a flag indicating whether the intra-frame prediction mode of the current block is a planar mode, or a flag indicating whether the intra-frame prediction mode of the current block is a DC mode may be signaled through the bitstream.
[0422] Alternatively, the intra prediction mode of the current block may be determined based on MPM candidates or residual mode information.
[0423] When the intra prediction mode of the current block is a non-directional mode, bidirectional intra prediction is not applied to the current block (S2320).
[0424] When the intra prediction mode of the current block is not a non-directional mode, it may be determined whether to apply bidirectional intra prediction to the current block (S2330). Whether to apply bidirectional intra prediction to the current block may be determined based on information parsed from the bitstream, the shape of the current block, the size of the current block, or the intra prediction mode of the current block.
[0425] For example, whether to apply bidirectional intra prediction to the current block may be determined based on a flag (e.g., bi_pred_flag) parsed from the bitstream. A value of bi_pred_flag of 0 indicates that bidirectional intra prediction is not applied to the current block, while a value of bi_pred_flag of 1 indicates that bidirectional intra prediction is applied to the current block. Alternatively, whether to apply bidirectional intra prediction to the current block may be determined based on whether the intra prediction mode of the current block is a directional prediction mode to which bidirectional intra prediction is applied.
[0426] In order to perform unidirectional or bidirectional intra prediction, a reference sample of the current block may be derived. The reference sample may include a first reference sample adjacent to the left and upper sides of the current block and a second reference sample adjacent to the right and lower sides of the current block. The second reference sample may be derived only when bidirectional intra prediction is applied to the current block.
[0427] If bidirectional intra prediction is not applied to the current block, unidirectional intra prediction may be performed according to the intra prediction mode of the current block (S2340). In the unidirectional intra prediction, a prediction sample may be obtained based on at least one of the first reference samples.
[0428] When bidirectional intra prediction is applied to the current block, bidirectional intra prediction (S2350) may be performed according to the intra prediction mode of the current block. In the bidirectional intra prediction, prediction samples may be obtained based on a first prediction image obtained based on at least one of the first basic reference samples and a second prediction image obtained based on at least one of the second basic reference samples. The first basic reference sample and the second basic reference sample may be determined based on the directionality of the intra prediction mode, or may be determined based on the size, shape, or position of other basic reference samples of the current block. When acquiring the first prediction image and the second prediction image, the prediction sample may be obtained by weighted prediction of the first prediction image and the second prediction image.
[0429] As previously referenced Fig.11 As described, the MPM candidate can be derived based on the intra-frame prediction mode of the neighboring blocks adjacent to the current block. According to an embodiment of the present invention, the MPM candidate can be derived based on the intra-frame prediction mode of the block not adjacent to the current block. In the embodiment to be described later, the block used to derive the MPM candidate will be referred to as a candidate block. In addition, among the candidate blocks, the neighboring blocks adjacent to the current block are referred to as first candidate blocks, and the blocks not adjacent to the current block are referred to as second candidate blocks.
[0430] Fig.24 is a diagram showing candidate blocks.
[0431] At least one of a block L adjacent to the left boundary of the current block, a block A adjacent to the upper side of the current block, or a block D adjacent to the upper left corner of the current block may be used as a first candidate block. Assuming that the position of the upper left sample of the current block is (0, 0), block A may include a sample at the position (0, -1), and block L may include a sample at the position (-1, 0). Unlike the illustrated example, a block including a sample at the position (0, W-1) or a sample at the position (0, (W / 2)-1) may be set to block A. Alternatively, a block including a sample at the position (H-1, 0) or a sample at the position ((H / 2)-1, 0) may be set to block L. Here, W represents the width of the current block, and H represents the height of the current block.
[0432] A block in which at least one of the vertical distance or the horizontal distance from the first candidate block has a predetermined value may be used as the second candidate block. For example, at least one of the block EA located at the upper side of the block A adjacent to the upper side of the current block, the block EL located at the left side of the block L adjacent to the left side of the current block, or the block ED located in the diagonal direction of the block D adjacent to the upper left corner of the current block may be used as the second candidate block. Block EA has a predetermined value for the y coordinate difference with block A, and block EL has a predetermined value for the x coordinate difference with block L. Block ED has predetermined values for the x coordinate difference with block D and the y coordinate interpolation. Therefore, block ED may have the same x coordinate as block EL and the same y coordinate as block EA.
[0433] The horizontal distance or vertical distance between the first candidate block and the second candidate block may be 4, 8, 16 or more. The horizontal distance or vertical distance between the first candidate block and the second candidate block may be a predefined value in the encoder and the decoder. Alternatively, at least one of the horizontal distance or the vertical distance may be determined based on at least one of the size or shape of the current block. For example, when the height of the current block is greater than the width, the horizontal distance may be set to N, and the vertical distance may be set to 2N. Conversely, when the width of the current block is greater than the height, the vertical distance may be set to N, and the horizontal distance may be set to 2N.
[0434] Considering that the partitioning mode is different for each coding block, there may be multiple upper adjacent blocks adjacent to the upper boundary of the current block or multiple adjacent blocks adjacent to the left boundary of the current block. When there are multiple upper adjacent blocks adjacent to the upper boundary of the current block, at least one of the multiple upper adjacent blocks can be used as the first candidate block. As an example, at least one of the leftmost block, the rightmost block, or the center block of the multiple upper adjacent blocks can be used as the first candidate block. When there are multiple left adjacent blocks adjacent to the left boundary of the current block, at least one of the multiple left adjacent blocks can be used as the first candidate block. For example, at least one of the uppermost block, the lowermost block, or the center block of the multiple upper adjacent blocks can be used as the first candidate block.
[0435] The MPM candidate may be derived based on at least one of the first candidate block or the second candidate block. The number of MPM candidates may be 3, 4, 5, 6 or more. The number of MPM candidates may be a fixed value predetermined by the encoder and the decoder. Alternatively, the number of MPM candidates may be determined based on information about the size, shape, partition type, partition depth, color component (e.g., brightness or color difference) or intra prediction mode of the current block. Alternatively, information for determining the number of MPM candidates may be signaled via a bitstream. The information may indicate a maximum or minimum number of MPM candidates included in the candidate list.
[0436] The MPM candidates may be derived based on at least one intra prediction mode in the candidate block. As an example, the MPM candidates included in the candidate list may be derived as follows.
[0437] candModeList[0]=L, candModeList[1]=A, canModeList[2]=EL, candModeList[3]=EA, candModeList[4]=ED.
[0438] candModeList[i] represents the i-th MPM candidate. The index of the MPM candidate can be determined based on the priority between the candidate blocks. The priority in the candidate block can be determined according to the position of the candidate block. For example, the priority can be defined in the order of the left adjacent block, the upper adjacent block, the left non-adjacent block, the upper non-adjacent block, and the diagonal non-adjacent block.
[0439] Alternatively, the priority between the candidate blocks can be determined according to the size or shape of the current block. For example, when the current block is a block with a height greater than the width, the candidate block located on the left side of the current block can have a higher priority than the candidate block located on the upper side of the current block. For example, the priority can be determined in the order of the left adjacent block, the left non-adjacent block, the upper adjacent block, the upper non-adjacent block and the diagonal non-adjacent block. When the current block is a block with a width greater than the height, the candidate block located on the upper side of the current block can have a higher priority than the candidate block located on the left side of the current block. For example, the priority can be determined in the order of the upper adjacent block, the upper non-adjacent block, the left adjacent block, the left non-adjacent block and the diagonal non-adjacent block.
[0440] Alternatively, the MPM candidates included in the candidate list may be rearranged after the MPM candidates are derived according to a predefined order. The rearrangement of the MPM candidates may be performed based on a predetermined priority. The priority may be predetermined by the encoder and the decoder. The encoder and the decoder may rearrange the MPM candidates according to a predetermined priority. Alternatively, the priority may be determined based on the size / type of the current block, the size / type of the adjacent blocks, the distance between the current block and the candidate block, or the value of the MPM candidate mode. The priority of the MPM candidates may be determined by combining two or more of the conditions listed above.
[0441] Fig.25 This is a diagram for explaining the rearrangement of MPM candidates based on the shape of a block.
[0442] Rearrangement of the MPM candidates may be performed based on whether the current block and the candidate block have the same size / shape.
[0443] For example, when the shape of the candidate block is the same or similar to the current block, reordering can be performed so that the MPM candidate derived from the intra prediction mode of the candidate block has a high priority. The higher the priority of the candidate block, the smaller the index of the MPM candidate derived from the intra prediction mode of the candidate block.
[0444] As an example, assume that the initial candidate list is configured as follows.
[0445] candModeList[0]=L, candModeList[1]=A, canModeList[2]=EL, candModeList[3]=EA, candModeList[4]=D.
[0446] When the type of the current block is Nx2N, a high priority may be given to the MPM candidates derived from the Nx2N type blocks in the candidate blocks. Fig.25 , it is shown that the candidate block EA and the candidate block EL have an N×2N type. When there are multiple candidate blocks having the same shape as the current block, the priority between the multiple candidate blocks can be determined according to the initial priority. Therefore, the arrangement order of the MPM candidates included in the candidate list can be changed as follows.
[0447] candModeList[0]=EL, candModeList[1]=EA, canModeList[2]=L, candModeList[3]=A, candModeList[4]=D.
[0448] As another example, the distance between the current block and the candidate block may be considered to determine the priority of the MPM candidate. Specifically, the shorter the distance to the current block, the higher the priority may be assigned to the candidate block. As an example, the priority of a first candidate block adjacent to the current block may be higher than the priority of a second candidate block not adjacent to the current block.
[0449] Alternatively, the priority may be determined based on whether the MPM candidate is in planar mode, DC mode, vertical mode, or horizontal mode. For example, among the MPM candidates, planar mode, DC mode, vertical mode, or horizontal mode may have a higher priority than other MPM candidates. Alternatively, the priority among the MPM candidates may be determined by comparing the size of the mode values of the MPM candidates.
[0450] It is within the scope of the present invention to apply the embodiments described with emphasis on the decoding process or the encoding process to the encoding process or the decoding process. It is also within the scope of the present invention to change the embodiments described in a predetermined order to a different order.
[0451] According to the implementation mode of the present invention, the following scheme may also be included:
[0452] (1) A method for decoding an image, the method comprising:
[0453] deriving a most probable mode (MPM) candidate based on an intra prediction mode of a candidate block, wherein the candidate block includes a neighboring block adjacent to the current block and a non-neighboring block not adjacent to the current block;
[0454] Determine whether there is an MPM candidate having the same intra prediction mode as the current block among the MPM candidates; and
[0455] An intra prediction mode for the current block is derived based on the determination.
[0456] (2) The method according to (1), wherein the non-adjacent blocks are spaced apart from the adjacent blocks by a predetermined value in at least one of a horizontal distance or a vertical distance.
[0457] (3) The method according to (2), wherein the predetermined distance is determined based on at least one of a size or a shape of the current block.
[0458] (4) The method according to (1), wherein the index assigned to each of the MPM candidates is determined based on a priority among the candidate blocks.
[0459] (5) The method according to (4), wherein the priority is determined based on whether the shape of the current block is the same as the shape of the candidate block.
[0460] (6) The method according to (1), wherein deriving the intra-frame prediction mode includes determining whether the intra-frame prediction mode is a default mode,
[0461] Wherein the determination is based on a default mode flag signaled from the bitstream.
[0462] (7) The method according to (6), wherein the default mode includes at least one of a planar mode, a DC mode, a vertical mode, a horizontal mode, or a diagonal mode.
[0463] (8) A method for encoding an image, the method comprising:
[0464] deriving a most probable mode (MPM) candidate based on an intra prediction mode of a candidate block, wherein the candidate block includes a neighboring block adjacent to the current block and a non-neighboring block not adjacent to the current block;
[0465] Determine whether there is an MPM candidate having the same intra prediction mode as the current block among the MPM candidates; and
[0466] An intra prediction mode for the current block is derived based on the determination.
[0467] (9) The method according to (8), wherein the non-adjacent blocks are spaced apart from the adjacent blocks by a predetermined value in at least one of a horizontal distance or a vertical distance.
[0468] (10) The method according to (9), wherein the predetermined distance is determined based on at least one of a size or a shape of the current block.
[0469] (11) The method according to (8), wherein the index assigned to each of the MPM candidates is determined based on a priority among the candidate blocks.
[0470] (12) The method according to (11), wherein the priority is determined based on whether the shape of the current block is the same as the shape of the candidate block.
[0471] (13) The method according to (8), wherein deriving the intra-frame prediction mode includes determining whether the intra-frame prediction mode is a default mode;
[0472] Wherein, a default mode flag is determined according to the determination result.
[0473] (14) The method according to (13), wherein the default mode includes at least one of a planar mode, a DC mode, a vertical mode, a horizontal mode, or a diagonal mode.
[0474] (15) A device for decoding an image, the device comprising:
[0475] an intra prediction unit that derives a most probable mode (MPM) candidate based on the intra prediction mode of the candidate block, determines whether there is an MPM candidate identical to the intra prediction mode of the current block among the MPM candidates, and derives the intra prediction mode of the current block based on the determination,
[0476] The candidate blocks include adjacent blocks adjacent to the current block and non-adjacent blocks not adjacent to the current block.
[0477] Although the above embodiments have been described based on a series of steps or flow charts, the above embodiments are not intended to limit the time series order of the present invention, and can be executed simultaneously or in different orders. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above embodiments can be implemented as a hardware device or software, and multiple components can be combined into one hardware device or software. The above embodiments can be implemented in the form of program instructions, which can be executed by various computer components and recorded in a computer-readable recording medium. Computer-readable storage media can include program instructions, data files, data structures, etc., alone or in combination. Examples of computer-readable storage media include: magnetic recording media such as hard disks, floppy disks, and tapes; optical data storage media such as CD-ROMs or DVD-ROMs; magneto-optical media such as optical disks; and hardware devices such as read-only memories (ROMs), random access memories (RAMs), and flash memories, which are particularly structured to store and implement program instructions. Hardware devices can be configured to be operated by one or more software modules or software modules can be configured to be operated by one or more hardware devices to perform processing according to the present invention.
[0478] Industrial Applicability
[0479] The present invention can be applied to electronic devices capable of encoding / decoding images.
Claims
1. A method for decoding an image, include: receiving a bitstream comprising the image; determining an intra prediction mode for a chrominance component of a current block in the image; Based on the intra prediction mode, performing intra prediction on a chroma component of the current block using one or more reference sample lines of the current block; as well as obtaining a reconstructed sample of a chrominance component of the current block by using the prediction sample generated by the intra prediction, The number of one or more reference sample lines that can be used for the chrominance component of the current block is adaptively determined based on the position of the current block in the coding tree unit CTU.
2. The method according to claim 1, in, In the case where the current block is located on the boundary of the CTU, performing intra prediction on the chrominance component of the current block using one reference sample line, and Wherein, when the current block is not located on the boundary of the CTU, three reference sample lines are used to perform intra-frame prediction on the chrominance component of the current block.
3. The method according to claim 2, in, The one reference sample line is adjacent to the current block.
4. The method according to claim 3, in, The three reference sample lines include a first reference sample line adjacent to the current block, a second reference sample line adjacent to the first reference sample line, and a third reference sample line adjacent to the second reference sample line.
5. The method according to claim 4, in, Intra prediction of the chroma component of the current block is performed based on a weighted sum of a plurality of reference samples belonging to the one reference sample line or the three reference sample lines.
6. The method according to claim 5, in, In response to the current block not being located on the boundary of the CTU, at least one of the plurality of reference samples belongs to a reference sample line different from other reference samples.
7. A method for encoding an image, include: performing intra prediction of a chroma component of a current block in an image by using one or more reference sample lines of the current block; obtaining a residual block of a chrominance component of the current block based on a prediction block generated by performing the intra prediction; Obtaining residual samples of the chrominance components of the current block by subtracting predicted samples generated by the intra prediction from original samples; as well as Generate a bitstream by encoding the residual samples, The number of one or more reference sample lines that can be used for intra-frame prediction of the chrominance component of the current block is adaptively determined based on the position of the current block in the coding tree unit CTU.
8. A device for transmitting compressed video data, include: a processor configured to obtain the compressed video data; as well as a transmitting unit configured to transmit the compressed video data, Wherein, obtaining the compressed video data comprises: performing intra prediction of a chroma component of a current block by using one or more reference sample lines of the current block in the image; obtaining a residual block of a chrominance component of the current block based on a prediction block generated by performing the intra prediction; Obtaining residual samples of the chrominance components of the current block by subtracting predicted samples generated by the intra prediction from original samples; and generating the compressed video data by encoding the residual samples, The number of one or more reference sample lines that can be used for intra-frame prediction of the chrominance component of the current block is adaptively determined based on the position of the current block in the coding tree unit CTU.
