Method for encoding and decoding video, and method for transmitting video data
By determining the intra-frame prediction mode and the offset of the reference sample in video signal encoding and decoding, and adjusting the reference sample weight using weighting and distance, the problem of low intra-frame prediction efficiency is solved and the encoding and decoding efficiency is improved.
Patent Information
- Application Number
- CN202310692712.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2016-10-04
- Filing Date
- 2017-09-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2037-09-29
AI Technical Summary
When encoding and decoding high-resolution and high-quality video signals, the existing technology has low intra-frame prediction efficiency and is difficult to effectively use multiple reference samples for weighted prediction and offset improvement.
By determining the intra-frame prediction mode of the current block, obtaining a reference sample, and calculating an offset based on the intra-frame prediction mode and the reference sample, applying it to the first prediction sample to generate a second prediction sample, and using weighted sum distance to adjust the weight of the reference sample, including reference samples with fixed positions and those dependent on the position of the first prediction sample.
The efficiency of encoding and decoding video signals is improved, and the encoding and decoding effects are enhanced by improving intra-frame prediction samples.
Smart Images

Figure CN116668690B_ABST
Abstract
Description
[0001] This invention application is a divisional application of invention patent application No. 201780061233.4, filed on September 29, 2017, with international application number PCT / KR2017 / 011055, which entered the Chinese national phase on April 2, 2019 and is titled “Method and device for processing video signals”. Technical Field
[0002] The present invention relates to a method and apparatus for processing a video signal. Background Art
[0003] 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, the amount of image data with higher resolution and quality increases compared to conventional image data. Therefore, when image data is transmitted by using a medium such as a conventional wired and wireless broadband network, or when 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.
[0004] Image compression technology includes various technologies, including: inter-frame prediction technology that predicts pixel values included in a current picture based on previous or subsequent pictures of the current picture; intra-frame prediction technology that predicts pixel values included in a current picture by using pixel information in the current picture; entropy coding technology that assigns short codes to values that appear frequently and long codes to values that appear infrequently, etc. By using such image compression technology, image data can be efficiently compressed and transmitted or stored.
[0005] At the same time, as the demand for high-resolution images increases, 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 discussed. Summary of the Invention
[0006] Technical issues
[0007] An object of the present invention is to provide a method and apparatus for efficiently performing intra prediction on an encoding / decoding target block when encoding / decoding a video signal.
[0008] An object of the present invention is to provide a method and apparatus for performing intra prediction through weighted prediction using a plurality of reference samples when encoding / decoding a video signal.
[0009] An object of the present invention is to provide a method and apparatus for refining prediction samples generated by intra prediction using an offset when encoding / decoding a video signal.
[0010] An object of the present invention is to provide a method and apparatus for improving prediction samples generated by intra-frame prediction by using offsets when encoding / decoding a video signal, and further using different offsets in predetermined units.
[0011] The technical objectives to be achieved by the present invention are not limited to the above technical problems. Moreover, those skilled in the art will clearly understand other technical problems not mentioned based on the following description.
[0012] Technical Solution
[0013] The method and apparatus for decoding a video signal according to the present invention can: determine an intra-frame prediction mode of a current block, obtain a reference sample based on adjacent samples of the current block, obtain a first prediction sample of the current block based on the intra-frame prediction mode and the reference sample, determine an offset of the first prediction sample, and obtain a second prediction sample by applying the offset to the first prediction sample.
[0014] The method and apparatus for encoding a video signal according to the present invention can: determine an intra-frame prediction mode of a current block, obtain a reference sample based on adjacent samples of the current block, obtain a first prediction sample of the current block based on the intra-frame prediction mode and the reference sample, determine an offset of the first prediction sample, and obtain a second prediction sample by applying the offset to the first prediction sample.
[0015] In the method and apparatus for encoding / decoding a video signal according to the present invention, whether to apply an offset to a first prediction sample may be determined based on an intra prediction mode of a current block.
[0016] In the method and apparatus for encoding / decoding a video signal according to the present invention, the offset may be determined based on a weighted sum of reference samples.
[0017] In the method and apparatus for encoding / decoding a video signal according to the present invention, a weight applied to each of the reference samples is determined based on a distance from a first prediction sample.
[0018] In the method and apparatus for encoding / decoding a video signal according to the present invention, the reference samples include reference samples at fixed positions and reference samples determined depending on the position of the first prediction sample.
[0019] In the method and apparatus for encoding / decoding a video signal according to the present invention, the reference sample at a fixed position may include a reference sample adjacent to the upper left corner of the current block, and the reference sample determined depending on the position of the first prediction sample may include at least one of the following reference samples: a reference sample on the same horizontal line as the first prediction sample, or a reference sample on the same vertical line as the first prediction sample.
[0020] In the method and apparatus for encoding / decoding a video signal according to the present invention, each of the reference samples may be included in a different reference line.
[0021] According to one aspect of the present application, a method for decoding a video is provided, comprising: determining an intra-frame prediction mode of a current block based on a candidate list, the candidate list including multiple candidates, the multiple candidates being determined based on the intra-frame prediction modes of neighboring blocks adjacent to the current block; obtaining reference samples for intra-frame prediction of the current block from neighboring samples adjacent to the current block; obtaining a first prediction sample of the current block based on the intra-frame prediction mode and the reference samples; determining an offset for modifying the first prediction sample; and obtaining a second prediction sample by modifying the first prediction sample based on the offset, wherein the offset is obtained based on at least one reference sample among the reference samples, wherein the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a non-directional mode, and wherein the non-directional mode includes a DC mode.
[0022] According to another aspect of the present application, a method for encoding a video is provided, comprising: determining an intra-frame prediction mode of a current block based on a candidate list, the candidate list including multiple candidates, the multiple candidates being determined based on the intra-frame prediction modes of neighboring blocks adjacent to the current block; obtaining reference samples for intra-frame prediction of the current block from neighboring samples adjacent to the current block; obtaining a first prediction sample of the current block based on the intra-frame prediction mode and the reference samples; determining an offset for modifying the first prediction sample; and obtaining a second prediction sample by modifying the first prediction sample based on the offset, wherein the offset is obtained based on at least one reference sample among the reference samples, and wherein the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a non-directional mode, and wherein the non-directional mode includes a DC mode.
[0023] According to another aspect of the present application, a method for sending video data is provided, comprising: determining an intra-frame prediction mode of a current block based on a candidate list, the candidate list including multiple candidates, the multiple candidates being determined based on the intra-frame prediction modes of neighboring blocks adjacent to the current block; obtaining reference samples for intra-frame prediction of the current block from neighboring samples adjacent to the current block; obtaining a first prediction sample of the current block based on the intra-frame prediction mode and the reference samples; determining an offset for modifying the first prediction sample; obtaining a second prediction sample by modifying the first prediction sample based on the offset; encoding the current block based on the second prediction sample to generate a bitstream; and transmitting the video data including the bitstream, wherein the offset is obtained based on at least one reference sample of the reference samples, and wherein the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra-frame prediction mode of the current block is a non-directional mode, and wherein the non-directional mode includes a DC mode.
[0024] The features briefly summarized above are merely illustrative aspects of the detailed description of the invention that follows and do not limit the scope of the invention.
[0025] Beneficial effects
[0026] According to the present invention, intra prediction can be efficiently performed on an encoding / decoding target block.
[0027] According to the present invention, intra prediction may be performed based on weighted prediction using a plurality of reference samples.
[0028] According to the present invention, encoding / decoding efficiency can be improved by improving prediction samples generated by intra prediction.
[0029] Effects that can be obtained by the present invention are not limited to the above-mentioned effects, and other effects that are not mentioned can be clearly understood by those skilled in the art from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0031] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0032] Figure 3 2 is a diagram illustrating an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0033] Figure 4 is a diagram illustrating partition types that allow binary tree-based partitioning according to an embodiment of the present invention.
[0034] Figure 5 is a diagram illustrating an example of allowing only predetermined types of binary tree-based partitioning according to an embodiment of the present invention.
[0035] Figure 6 1 is a diagram for explaining an example of encoding / decoding information on the allowable number of binary tree divisions according to an embodiment to which the present invention is applied.
[0036] Figure 7 is a diagram illustrating a partitioning pattern applicable to a coding block according to an embodiment of the present invention.
[0037] Figure 8 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.
[0038] Figure 9 is a diagram illustrating a type of extended intra prediction mode according to an embodiment of the present invention.
[0039] Figure 10 FIG. 1 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0040] Figure 11 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.
[0041] Figure 12 and Figure 13 is a diagram illustrating a method of correcting a prediction sample based on a predetermined correction filter according to an embodiment of the present invention.
[0042] Figure 14 Shown is a range of reference samples used for intra prediction according to an embodiment to which the present invention is applied.
[0043] Figure 15 is a diagram illustrating a plurality of reference sample lines.
[0044] Figure 16 is a flowchart illustrating a method for improving prediction samples according to an embodiment of the present invention.
[0045] Figure 17 is a flowchart illustrating a method for improving a predicted image in units of sub-blocks according to an embodiment of the present invention.
[0046] Figures 18 to 22 FIG. 1 is a diagram illustrating an intra prediction method for a current block according to an embodiment to which the present invention is applied.
[0047] Figure 23 and Figure 24 is a diagram showing an example of applying different offsets in predetermined units in a sub-block.
[0048] Figure 25 is a flowchart illustrating a process of obtaining residual samples according to an embodiment to which the present invention is applied. DETAILED DESCRIPTION
[0049] The present invention can be modified in various ways and there are various embodiments of the present invention. Examples of various embodiments will now be provided with reference to the accompanying drawings and will be described in detail. However, the present invention is not limited thereto, and 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, like reference numerals refer to like elements.
[0050] The terms "first," "second," and the like used in the specification may be used to describe various components, but these components are not to be construed as being limited to these terms. These terms are merely used to distinguish one component from other components. For example, a "first" component may be referred to as a "second" component, and a "second" component may similarly be referred to as a "first" component, without departing from the scope of the present invention. The term "and / or" includes a combination of multiple items or any one of the multiple terms.
[0051] It should be understood that, in this specification, when an element is simply referred to as being “connected to” or “coupled to” another element rather than being “directly connected to” or “directly coupled to” another element, the element may be “directly connected to” or “directly coupled to” the other element, or the element may be connected to or coupled to the other element with other elements interposed therebetween. Conversely, it should be understood that when an element is referred to as being “directly coupled to” or “directly connected to” another element, there are no intervening elements.
[0052] 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 they have significantly different meanings in the context. In this specification, it should be understood that terms such as "including", "having" etc. are intended to indicate the presence 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.
[0053] 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.
[0054] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0055] Reference Figure 1 , the device 100 for encoding a video may include: a picture partitioning 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.
[0056] Figure 1 The components shown in the figures are shown independently to represent the characteristic functions that are different from each other in the device for encoding video. Therefore, this does not mean that each component is composed of a separate hardware or software component. In other words, for convenience, each component includes each of the listed components. Therefore, at least two components of each component can be combined to form one component, or one component can be divided into multiple components to perform each function. Without departing from the essence of the present invention, embodiments of combining each component and embodiments of dividing one component are also included in the scope of the present invention.
[0057] In addition, some of the components may not be indispensable components for performing the basic functions of the present invention, but may be optional components that are only used to improve the performance of the present invention. The present invention can be implemented by excluding components that are used to improve performance and only including indispensable components for realizing the essence of the present invention. Structures that exclude optional components that are only used to improve performance and only include indispensable components are also included in the scope of the present invention.
[0058] The picture partition 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 partition module 110 may partition a picture into a combination of multiple coding units, prediction units, and transform units, and may encode the picture by selecting a combination of coding units, prediction units, and transform units using a predetermined criterion (e.g., a cost function).
[0059] For example, a picture can be divided into multiple coding units. A recursive tree structure such as a quadtree structure can 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 the root can be divided in such a way that the number of child nodes corresponds to the number of divided coding units. Coding units that cannot be further divided by predetermined restrictions serve as leaf nodes. That is, when it is assumed that only square division is feasible for a coding unit, a coding unit can be divided into a maximum of four other coding units.
[0060] Hereinafter, in an embodiment of the present invention, a coding unit may mean a unit that performs encoding or a unit that performs decoding.
[0061] The prediction unit may be one of partitions partitioned 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 partitioned so as to have different shapes / sizes in a single coding unit.
[0062] When a prediction unit to be intra-predicted 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 N×N.
[0063] The prediction modules 120 and 125 may include an inter-frame prediction module 120 for performing inter-frame prediction and an intra-frame prediction module 125 for performing intra-frame prediction. Whether inter-frame or intra-frame prediction is performed for a prediction unit may be determined, and detailed information based on each prediction method (e.g., intra-frame prediction mode, motion vector, reference picture, etc.) may be determined. The processing unit performing the prediction may be different from the processing unit for which the prediction method and details 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. Furthermore, the prediction mode information, motion vector information, etc. used for the prediction may be encoded along with the residual value by the entropy encoding module 165 and transmitted to a device for decoding video. When using a specific encoding mode, the original block may be encoded as is, without generating a prediction block through the prediction modules 120 and 125, for transmission to a device for decoding video.
[0064] The inter-frame prediction module 120 can 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, can predict a prediction unit based on information of some coding regions in the current picture. The inter-frame prediction module 120 can include a reference picture interpolation module, a motion prediction module, and a motion compensation module.
[0065] The reference picture interpolation module can receive reference picture information from the memory 155 and generate pixel information of integer pixels or less than integer pixels based on the reference picture. In the case of luma pixels, an 8-tap DCT-based interpolation filter with different filter coefficients can 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 DCT-based interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 8 pixels.
[0066] The motion prediction module can perform motion prediction based on the reference picture interpolated by the reference picture interpolation module. As a method for calculating the motion vector, various methods can be used, such as the full search based block matching algorithm (FBMA), the three-step search (TSS), and the new three-step search algorithm (NTS). 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. As the motion prediction method, various methods can be used, such as the skip method, the merge method, the AMVP (Advanced Motion Vector Prediction) method, the intra-frame block copy method, etc.
[0067] The intra-frame prediction module 125 can generate a prediction unit based on reference pixel information adjacent to the current block, which is pixel information in the current picture. When the neighboring block of the current prediction unit is a block to be inter-frame predicted and the reference pixel is therefore a pixel to be inter-frame predicted, the reference pixel information of the neighboring block to be intra-frame predicted can be used to replace the reference pixel included in the block to be inter-frame predicted. In other words, when the reference pixel is unavailable, at least one reference pixel among the available reference pixels can be used to replace the unavailable reference pixel information.
[0068] The prediction mode in intra-frame prediction may include a directional prediction mode that uses reference pixel information depending on the prediction direction and a non-directional prediction mode that does not use directional information when performing prediction. The mode for predicting luma information may be different from the mode for predicting chroma information, and to predict chroma information, the intra-frame prediction mode information for predicting luma information or the predicted luma signal information may be used.
[0069] When performing intra prediction, if 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 to the left, upper left, and upper sides of the prediction unit. However, when performing intra prediction, if 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 N×N partitioning can be used only for the smallest coding unit.
[0070] In the intra prediction method, a prediction block can be generated after applying an AIS (Adaptive Intra Smoothing) filter to reference pixels depending on a prediction mode. The type of the AIS filter applied to the reference pixels can vary. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit can be predicted based on the intra prediction mode of a prediction unit adjacent to the current prediction unit. In predicting the prediction mode of the current prediction unit by using mode information predicted based on the adjacent prediction units, 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 can 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. When the prediction mode of the current prediction unit is different from the prediction mode of the adjacent prediction unit, entropy coding can be performed to encode the prediction mode information of the current block.
[0071] In addition, a residual block including information on a residual value, which is a difference between the prediction unit to be predicted 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.
[0072] The transform module 130 may transform the residual block including information about a 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 to transform the residual block may be determined based on intra prediction mode information of the prediction unit used to generate the residual block.
[0073] The quantization module 135 may quantize the value transformed to the frequency domain by the transform module 130. The quantization coefficient may vary depending on 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.
[0074] The rearrangement module 160 may rearrange the coefficients of the quantized residual value.
[0075] The rearrangement module 160 can convert the coefficients in the two-dimensional block form into coefficients in the one-dimensional vector form using a coefficient scanning method. For example, the rearrangement module 160 can use a zigzag scanning method to scan from the DC coefficient to the coefficients in the high frequency domain to convert the coefficients into the one-dimensional vector form. Depending on the size of the transform unit and the intra-frame prediction mode, vertical scanning, which scans the coefficients in the two-dimensional block form along the column direction, or horizontal scanning, which scans the coefficients in the two-dimensional block form along the row direction, can be used instead of the zigzag scan. In other words, the zigzag scanning, vertical scanning, and horizontal scanning method to be used can be determined depending on the size of the transform unit and the intra-frame prediction mode.
[0076] 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).
[0077] The entropy coding module 165 can encode various information from the rearrangement module 160 and the prediction modules 120 and 125, such as the 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.
[0078] The entropy encoding module 165 may entropy encode coefficients of the coding unit input from the rearrangement module 160 .
[0079] 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.
[0080] The filter module 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0081] A deblocking filter can remove block artifacts that occur due to boundaries between blocks in a reconstructed image. To determine whether to perform deblocking, pixels in a number of rows or columns of a block can be used as a basis for determining whether to apply a deblocking filter to the current block. When a deblocking filter is applied to a block, a strong or weak filter can be applied depending on the desired deblocking filter strength. Furthermore, when applying a deblocking filter, horizontal and vertical filtering can be processed in parallel.
[0082] The offset correction module can correct the offset from the original image on a pixel-by-pixel basis in the image to be deblocked. To perform offset correction on a specific image, a method can be used that applies an offset by considering edge information for each pixel, or a method can be used that divides the pixels of the image into a predetermined number of regions, determines the regions to be offset, and applies an offset to the determined regions.
[0083] Adaptive loop filtering (ALF) can be performed based on the value obtained by comparing the reconstructed picture after filtering with the original picture. The pixels included in the picture can be divided into predetermined groups, the filter to be applied to each group can be determined, and filtering can be performed separately for each group. Information on whether to apply ALF and the luminance signal can be transmitted by the coding unit (CU). The shape and filter coefficients of the filter used for ALF can vary depending on each block. In addition, regardless of the characteristics of the application target block, the filter of the same shape (fixed shape) for ALF can be applied.
[0084] 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.
[0085] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0086] 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 .
[0087] When a video bitstream is input from an apparatus for encoding a video, the input bitstream may be decoded according to an inverse process of the apparatus for encoding a video.
[0088] The entropy decoding module 210 may perform entropy decoding according to the inverse process of the entropy encoding performed by the entropy encoding module of the apparatus for encoding the video. For example, corresponding to the method performed by the apparatus for encoding the video, various methods such as exponential Golomb coding, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC) may be applied.
[0089] The entropy decoding module 210 may decode information about intra prediction and inter prediction performed by the apparatus for encoding a video.
[0090] The rearrangement module 215 can rearrange the bitstream entropy-decoded by the entropy decoding module 210 based on the rearrangement method used in the apparatus for encoding video. The rearrangement module can reconstruct and rearrange the coefficients in the form of a one-dimensional vector into coefficients in the form of a two-dimensional block. The rearrangement module 215 can receive information related to coefficient scanning performed in the apparatus for encoding video and can perform rearrangement by inversely scanning the coefficients based on the scanning order performed in the apparatus for encoding video.
[0091] The inverse quantization module 220 may perform inverse quantization based on a quantization parameter received from an apparatus for encoding a video and coefficients of the rearranged block.
[0092] The inverse transform module 225 can perform inverse transforms, namely, inverse DCT, inverse DST, and inverse KLT, which are the inverse processes of the transforms, namely, DCT, DST, and KLT, performed by the transform module on the quantization results of the device used to encode the video. The inverse transform can be performed based on the transform unit determined by the device used to encode the video. The inverse transform module 225 of the device used to decode the video can selectively perform transform schemes such as DCT, DST, and KLT based on multiple pieces of information, such as the prediction method, the size of the current block, the prediction direction, etc.
[0093] 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 .
[0094] As described above, similar to the operation of the apparatus for encoding video, when performing intra-frame prediction, when the size of the prediction unit is the same as the size of the transform unit, intra-frame prediction can be performed on the prediction unit based on pixels located to the left, upper left, and upper sides of the prediction unit. When performing intra-frame prediction, when the size of the prediction unit is different from the size of the transform unit, intra-frame prediction can be performed using reference pixels based on the transform unit. In addition, intra-frame prediction using N×N partitioning can be used only for the minimum coding unit.
[0095] 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 from the entropy decoding module 210, such as prediction unit information, prediction mode information for the intra-frame prediction method, information about motion prediction for the inter-frame prediction method, etc., 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 for inter-frame prediction of the current prediction unit received from the device for encoding 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 regions in the current picture including the current prediction unit.
[0096] In order to perform inter prediction, which one 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.
[0097] 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 to be intra-predicted, intra-prediction can be performed based on the 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 may determine whether to apply the filter depending on the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixels of the current block by using the prediction mode and AIS filter information of the prediction unit received from the device for encoding the video. 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.
[0098] When the prediction mode of the prediction unit is a prediction mode for performing intra-frame prediction based on pixel values obtained by interpolating reference pixels, the reference pixel interpolation module can interpolate the reference pixels to generate integer pixels or reference pixels smaller than integer pixels. When the prediction mode of the current prediction unit is a prediction mode for generating a prediction block without interpolating reference pixels, the reference pixels may not be interpolated. When the prediction mode of the current block is DC mode, the DC filter can generate a prediction block through filtering.
[0099] The reconstructed block or the reconstructed 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.
[0100] Information on whether to apply a deblocking filter to a corresponding block or picture and information on which filter to apply, a strong filter or a weak filter, when applying the deblocking filter may be received from a device for encoding a video. A deblocking filter of a device for decoding a video may receive information on the deblocking filter from a device for encoding the video and may perform deblocking filtering on the corresponding block.
[0101] The offset correction module may perform offset correction on the reconstructed picture based on the type of offset correction and offset value information applied to the picture when encoding is performed.
[0102] ALF may be applied to a coding unit based on information on whether ALF is applied and ALF coefficient information received from an apparatus for encoding a video, etc. The ALF information may be provided to be included in a specific parameter set.
[0103] The memory 245 may store the reconstructed picture or the reconstructed block to be used as a reference picture or a reference block, and may provide the reconstructed picture to the output module.
[0104] As described above, in the embodiment of the present invention, for convenience of explanation, a coding unit is used as a term indicating a unit for encoding, however, the coding unit may be used as a unit that performs decoding as well as encoding.
[0105] In addition, the current block can represent a target block to be encoded / decoded. And, depending on the encoding / decoding step, the current block can 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.
[0106] A picture can be encoded / decoded by dividing it into basic blocks having a square or non-square shape. At this time, the basic block can be called 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 about whether the coding tree unit has a square shape or a non-square shape or information about 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 partitions of smaller sizes. At this time, if it is assumed that the depth of the partition generated by dividing the coding tree unit is 1, the depth of the partition generated by dividing the partition with a depth of 1 can be defined as 2. That is, the partition generated by dividing the partition with a depth of k in the coding tree unit can be defined as having a depth of k+1.
[0107] 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 basic units for performing prediction, quantization, transform, 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 transform unit or a prediction unit, which is a basic unit for performing prediction, quantization, transform, or loop filtering, etc.
[0108] The division of the coding tree unit or the coding unit may be performed based on at least one of a vertical line and a horizontal line. In addition, the number of vertical lines or horizontal lines that divide the coding tree unit or the coding unit may be at least one or more. For example, the coding tree unit or the coding unit may be divided into two divisions using one vertical line or one horizontal line, or may be divided into three divisions using two vertical lines or two horizontal lines. Alternatively, the coding tree unit or the coding unit may be divided into four divisions having a length and a width of 1 / 2 by using one vertical line and one horizontal line.
[0109] When a coding tree unit or a coding unit is divided into a plurality of partitions using at least one vertical line or at least one horizontal line, the partitions may have a uniform size or different sizes. Alternatively, any one partition may have a different size from the remaining partitions.
[0110] In the embodiments described below, it is assumed that the coding tree unit or the coding unit is divided into a quadtree structure or a binary tree structure. However, the coding tree unit or the coding unit may be divided using a greater number of vertical lines or a greater number of horizontal lines.
[0111] Figure 3 2 is a diagram illustrating an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0112] The input video signal is decoded in predetermined block units. Such a default unit for decoding the input video signal is a coding block. The coding block may be a block that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., intra prediction mode or inter prediction mode) is determined in units of coding blocks, and the prediction blocks included in the coding block may share the determined prediction mode. The coding block may be a square block or a non-square block having any size in the range of 8×8 to 64×64, or may be a square block or a non-square block having a size of 128×128, 256×256, or larger.
[0113] Specifically, the coding block may be hierarchically divided based on at least one of a quadtree and a binary tree. Here, quadtree-based division may mean dividing a 2N×2N coding block into four N×N coding blocks, and binary tree-based division may mean dividing one coding block into two coding blocks. Even when binary tree-based division is performed, square-shaped coding blocks may exist at a lower depth.
[0114] The binary tree-based partitioning can be performed symmetrically or asymmetrically. The coding block based on the binary tree partitioning can be a square block or a non-square block, such as a rectangular shape. For example, the partitioning type allowing the binary tree-based partitioning may include at least one of a symmetric type of 2N×N (non-square coding unit in the horizontal direction) or N×2N (non-square coding unit in the vertical direction), an asymmetric type of nL×2N, nR×2N, 2N×nU or 2N×nD.
[0115] Binary tree-based partitioning can be limited to either symmetric or asymmetric partitioning. In this case, constructing a coding tree unit using square blocks can correspond to quadtree CU partitioning, and constructing a coding tree unit using symmetric non-square blocks can correspond to binary tree partitioning. Constructing a coding tree unit using square blocks and symmetric non-square blocks can correspond to quadtree CU partitioning and binary tree CU partitioning.
[0116] Binary tree-based partitioning may be performed on a coding block for which quadtree-based partitioning is no longer performed. Quadtree-based partitioning may no longer be performed on a coding block for which binary tree-based partitioning is no longer performed.
[0117] In addition, the partitioning at a lower depth may be determined depending on the partitioning type at a higher depth. For example, if binary tree-based partitioning is allowed at two or more depths, only the same type as the binary tree partitioning at a higher depth may be allowed at a lower depth. For example, if a binary tree-based partitioning at a higher depth is performed using a 2N×N type, then a binary tree-based partitioning at a lower depth is also performed using a 2N×N type. Alternatively, if a binary tree-based partitioning at a higher depth is performed using an N×2N type, then a binary tree-based partitioning at a lower depth is also performed using an N×2N type.
[0118] In contrast, it is also possible to allow only types of binary tree partitioning at lower depths that are different from the types at higher depths.
[0119] It is possible to restrict the use of only certain types of binary tree-based partitions for sequences, slices, coding tree units, or coding units. As an example, for a coding tree unit, only 2N×N or N×2N binary tree-based partitions may be allowed. Available partition types may be predefined in the encoder or decoder. Alternatively, information about available partition types or information about unavailable partition types may be encoded and then signaled via the bitstream.
[0120] Figure 5 is a diagram showing an example in which only specific types of binary tree-based partitioning are allowed. Figure 5 A shows an example of binary tree-based partitioning that only allows N×2N types, and Figure 5 B shows an example in which only 2N×N type binary tree-based partitioning is allowed. To implement adaptive partitioning based on quadtree or binary tree, the following information may be used: information indicating quadtree-based partitioning, information about the size / depth of coding blocks for which quadtree-based partitioning is allowed, information indicating binary tree-based partitioning, information about the size / depth of coding blocks for which binary tree-based partitioning is allowed, information about the size / depth of coding blocks for which binary tree-based partitioning is not allowed, information about whether binary tree-based partitioning is performed in the vertical direction or in the horizontal direction, etc.
[0121] In addition, the following information about 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 can be obtained for a coding tree unit or a specific coding unit. The information can be encoded in units of coding tree units or coding units and can be transmitted to a decoder through a bitstream.
[0122] For example, the syntax "max_binary_depth_idx_minus1" indicating the maximum depth allowed for binary tree partitioning may be encoded / decoded through the bitstream. In this case, max_binary_depth_idx_minus1+1 may indicate the maximum depth allowed for binary tree partitioning.
[0123] Reference Figure 6 The example shown in Figure 6 , binary tree splitting has been performed on the coding unit having a depth of 2 and the coding unit having a depth of 3. Therefore, at least one of information indicating the number of times binary tree splitting has been performed in the coding tree unit (i.e., 2 times), information indicating the maximum depth at which binary tree splitting has been allowed in the coding tree unit (i.e., depth 3), or the number of depths at which binary tree splitting has been performed in the coding tree unit (i.e., 2 (depth 2 and depth 3)) may be encoded / decoded through the bitstream.
[0124] As another example, at least one of information about 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 can be obtained for each sequence or each slice. For example, the information can be encoded in units of sequence, picture, or slice and transmitted via a bitstream. Therefore, at least one of the number of times binary tree partitioning is allowed in the first slice, the maximum depth of binary tree partitioning allowed in the first slice, or the number of depths at which binary tree partitioning is performed in the first slice can be different from that in the second slice. For example, in the first slice, binary tree partitioning may be allowed only for one depth, while in the second slice, binary tree partitioning may be allowed for two depths.
[0125] As another example, 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 can be set differently according to a temporal level identifier (TemporalID) of a slice or picture. Here, the temporal level identifier (TemporalID) is used to identify each of a plurality of video layers having at least one of scalability of view, space, time, or quality.
[0126] like Figure 3As shown in , the first coding block 300 with a partition depth (split depth) of k can be divided into a plurality of 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 half the height of the first coding block, and the partition depth of the second coding block can be increased to k+1.
[0127] The second coding block 310 with a split depth of k+1 may be split into a plurality of third coding blocks with a split depth of k+2. The splitting of the second coding block 310 may be performed by selectively using one of a quadtree and a binary tree depending on the splitting method. Here, the splitting method may be determined based on at least one of information indicating quadtree-based splitting and information indicating binary tree-based splitting.
[0128] When the second coding block 310 is divided based on a quadtree, the second coding block 310 can be divided into four third coding blocks 310a having half the width and half the height of the second coding block, and the division depth of the third coding block 310a can be increased to k+2. In contrast, when the second coding block 310 is divided based on a binary tree, the second coding block 310 can be divided into two third coding blocks. Here, each of the two third coding blocks can be a non-square block having half the width and half the height of the second coding block, and the division depth can be increased to k+2. The second coding block can be determined as a non-square block in the horizontal direction or the vertical direction depending on the division direction, and the division direction can be determined based on information about whether the binary tree-based division is performed in the vertical direction or the horizontal direction.
[0129] Meanwhile, the second coding block 310 may be determined as a leaf coding block that is no longer partitioned based on a quadtree or a binary tree. In this case, the leaf coding block may be used as a prediction block or a transform block.
[0130] Similar to the division of the second coding block 310 , the third coding block 310 a may be determined as a leaf coding block, or may be further divided based on a quadtree or a binary tree.
[0131] At the same time, 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 relevant 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. In this case, the coding block 310b-1 can be used as a prediction block or a transform block. However, the above-mentioned division process can be performed restrictively based on at least one of the following information: 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, and information about the size / depth of the coding block that does not allow binary tree-based division.
[0132] 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. As an example, the size of the coding block in a sequence or a picture may be limited to 256×256, 128×128, or 32×32. Information indicating the size of the coding block in the sequence or in the picture may be signaled through a sequence header or a picture header.
[0133] As a result of quadtree and binary tree based partitioning, the coding unit may be represented in a square or rectangular shape of an arbitrary size.
[0134] The coding block is encoded using at least one of skip mode, intra prediction, inter prediction, or a skip method. Once the coding block is determined, a prediction block can be determined by predictive partitioning of the coding block. The predictive partitioning of the coding block can be performed using a partitioning mode (Part_mode) indicating the partitioning type of the coding block. The size or shape of the prediction block can be determined based on the partitioning mode of the coding block. For example, the size of the prediction block determined based on the partitioning mode can be equal to or smaller than the size of the coding block.
[0135] Figure 7 is a diagram showing partitioning modes that can be applied to a coding block when the coding block is encoded by inter-frame prediction.
[0136] When encoding a coding block by inter-frame prediction, one of eight partitioning modes can be applied to the coding block, such as Figure 7 The example shown in .
[0137] When a coding block is encoded through intra prediction, a partition mode PART_2N×2N or a partition mode PART_N×N may be applied to the coding block.
[0138] When the coding block has a minimum size, PART_N×N can be applied. Here, the minimum size of the coding block can be predefined in the encoder and decoder. Alternatively, information about the minimum size of the coding block can be signaled via the bitstream. For example, the minimum size of the coding block can be signaled via the slice header so that the minimum size of the coding block can be defined for each slice.
[0139] Generally, a prediction block may have a size from 64×64 to 4×4. However, when encoding a coding block through inter-frame prediction, the prediction block may be restricted to not have a 4×4 size to reduce memory bandwidth when performing motion compensation.
[0140] Figure 8 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.
[0141] An apparatus for encoding / decoding video may perform intra prediction using one of 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.
[0142] Alternatively, to improve the accuracy of intra-frame prediction, a greater number of directional prediction modes than 33 directional prediction modes may be used. That is, M extended directional prediction modes (M>33) may be defined by subdividing the angle of the directional prediction mode, and a directional prediction mode having a predetermined angle may be obtained using at least one of the 33 predefined directional prediction modes.
[0143] You can use more than Figure 8 A greater number of intra-frame prediction modes than the 35 intra-frame prediction modes shown in FIG. For example, a greater number of intra-frame prediction modes than the 35 intra-frame prediction modes may be used by subdividing the angle of the directional prediction mode or obtaining a directional prediction mode having a predetermined angle using at least one of a predefined number of directional prediction modes. In this case, the use of a greater number of intra-frame prediction modes than the 35 intra-frame prediction modes may be referred to as an extended intra-frame prediction mode.
[0144] Figure 9 An example of an extended intra prediction mode is shown, and the extended intra prediction mode may include two non-directional prediction modes and 65 extended directional prediction modes. The same number of extended intra prediction modes may be used for luma and chroma components, or a different number of intra prediction modes may be used for each component. For example, 67 extended intra prediction modes may be used for luma components, and 35 intra prediction modes may be used for chroma components.
[0145] Alternatively, depending on the chroma format, different numbers of intra-frame prediction modes can be used when performing intra-frame prediction. For example, in the case of the 4:2:0 format, 67 intra-frame prediction modes can be used for the luma component to perform intra-frame prediction, and 35 intra-frame prediction modes can be used for the chroma components. In the case of the 4:4:4 format, 67 intra-frame prediction modes can be used for the luma component and the chroma component to perform intra-frame prediction.
[0146] Alternatively, depending on the size and / or shape of the block, a different number of intra prediction modes may be used to perform intra prediction. That is, depending on the size and / or shape of the PU or CU, 35 intra prediction modes or 67 intra prediction modes may be used to perform intra prediction. For example, in the case where the CU or PU has a size smaller than 64×64 or is divided asymmetrically, 35 intra prediction modes may be used to perform intra prediction. In the case where the size of the CU or PU is equal to or larger than 64×64, 67 intra prediction modes may be used to perform intra prediction. 65 directional intra prediction modes may be allowed for Intra_2Nx2N, and only 35 directional intra prediction modes may be allowed for Intra_NxN.
[0147] The size of the block to which the extended intra prediction mode is applied can be set differently for each sequence, picture, or slice. For example, the extended intra prediction mode is set to be applied to blocks (e.g., CUs or PUs) with a size greater than 64×64 in the first slice. On the other hand, the extended intra prediction mode is set to be applied to blocks with a size greater than 32×32 in the second slice. Information indicating the size of the block to which the extended intra prediction mode is applied can be signaled in units of sequences, pictures, or slices. For example, the information indicating the size of the block to which the extended intra prediction mode is applied can be defined as 'log2_extended_intra_mode_size_minus4' obtained by taking the logarithm of the block size and then subtracting the integer 4. For example, if the value of log2_extended_intra_mode_size_minus4 is 0, this can indicate that the extended intra prediction mode can be applied to blocks with a size equal to or greater than 16×16. If the value of log2_extended_intra_mode_size_minus4 is 1, this can indicate that the extended intra prediction mode can be applied to blocks with a size equal to or greater than 32×32.
[0148] As described above, the number of intra-frame prediction modes can be determined by considering at least one of the color component, the chroma format, and the size or shape of the block. In addition, the number of intra-frame prediction mode candidates (for example, the number of MPMs) used to determine the intra-frame prediction mode of the current block to be encoded / decoded can also be determined based on at least one of the color component, the color format, and the size or shape of the block. A method of determining the intra-frame prediction mode of the current block to be encoded / decoded and a method of performing intra-frame prediction using the determined intra-frame prediction mode will be described using the accompanying drawings.
[0149] Figure 10 FIG. 1 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0150] Encoding / decoding efficiency can be improved by applying intra prediction to blocks included in an image having strong directionality, blocks included in an image not shown in a previous frame, and the like.
[0151] Reference Figure 10 , at step S1000 , the intra prediction mode of the current block may be determined.
[0152] Specifically, the intra-frame prediction mode of the current block can be obtained based on a candidate list and an index. Here, the candidate list contains multiple candidates, and the multiple candidates can be determined based on the intra-frame prediction modes of neighboring blocks adjacent to the current block. The neighboring blocks may include at least one block located above, below, to the left, to the right, or in a corner of the current block. The index can specify one of the multiple candidates in the candidate list. The candidate specified by the index can be set as the intra-frame prediction mode of the current block.
[0153] The intra-frame prediction mode used for intra-frame prediction in the adjacent block can be set as a candidate. In addition, the intra-frame prediction mode with a directionality similar to that of the intra-frame prediction mode of the adjacent block can be set as a candidate. Here, the intra-frame prediction mode with similar directionality can be determined by adding a predetermined constant value to the intra-frame prediction mode of the adjacent block or subtracting a predetermined constant value from the intra-frame prediction mode of the adjacent block. The predetermined constant value can be an integer, such as one, two, or more.
[0154] The candidate list may also include a default mode. The default mode may include at least one of a planar mode, a DC mode, a vertical mode, and a horizontal mode. The default mode may be adaptively added considering the maximum number of candidates that can be included in the candidate list of the current block.
[0155] The maximum number of candidates that can be included in the candidate list may be three, four, five, six or more. The maximum number of candidates that can be included in the candidate list may be a fixed value preset in the device for encoding / decoding video, or may be variably determined based on the characteristics of the current block. The characteristics may mean the position / size / shape of the block, the number / type of intra-frame prediction modes that the block can use, the color type, the color format, etc. Alternatively, information indicating the maximum number of candidates that can be included in the candidate list may be separately signaled, and the maximum number of candidates that can be included in the candidate list may be variably determined using the information. The information indicating the maximum number of candidates may be signaled at at least one of a sequence level, a picture level, a slice level, and a block level.
[0156] When the extended intra prediction mode and the 35 predefined intra prediction modes are selectively used, the intra prediction mode of the adjacent block can be transformed into an index corresponding to the extended intra prediction mode, or into an index corresponding to the 35 intra prediction modes, thereby obtaining a candidate. To convert to an index, a predefined table can be used, or a scaling operation based on a predetermined value can be used. Here, the predefined table can define the mapping relationship between different intra prediction mode groups (for example, the extended intra prediction mode and the 35 intra prediction modes).
[0157] For example, when the left neighboring block uses 35 intra prediction modes and the intra prediction mode of the left neighboring block is 10 (horizontal mode), it can be transformed into index 16 corresponding to the horizontal mode in the extended intra prediction mode.
[0158] Alternatively, in the case where the upper neighboring block uses the extended intra prediction mode and the intra prediction mode of the upper neighboring block has index 50 (vertical mode), it may be transformed into index 26 corresponding to the vertical mode among the 35 intra prediction modes.
[0159] Based on the above method of determining the intra prediction mode, the intra prediction mode may be independently obtained for each of the luma component and the chroma component, or the intra prediction mode of the chroma component may be obtained according to the intra prediction mode of the luma component.
[0160] 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 luma component.
[0161] [Table 1]
[0162]
[0163]
[0164] In Table 1, intra_chroma_pred_mode means information signaled to designate an intra prediction mode of a chroma component, and IntraPredModeY indicates an intra prediction mode of a luma component.
[0165] Reference Figure 10 , at step S1010 , reference samples for intra prediction of the current block may be obtained.
[0166] Specifically, reference samples for intra prediction may be obtained based on neighboring samples of the current block. The neighboring samples may be reconstructed samples of neighboring blocks, and the reconstructed samples may be reconstructed samples before or after the loop filter is applied.
[0167] Adjacent samples reconstructed before the current block can be used as reference samples, and adjacent samples filtered based on a predetermined intra-frame filter can be used as reference samples. Filtering adjacent samples using an intra-frame filter can also be called reference sample smoothing. The intra-frame filter may include at least one of the following filters: a first intra-frame filter applied to multiple adjacent samples located on the same horizontal line, and a second intra-frame filter applied to multiple adjacent samples located on the same vertical line. Depending on the position of the adjacent samples, one of the first intra-frame filter and the second intra-frame filter can be selectively applied, or both intra-frame filters can be applied. At this time, at least one filter coefficient of the first intra-frame filter or the second intra-frame filter can be (1, 2, 1), but is not limited thereto.
[0168] Filtering may be adaptively performed based on at least one of the intra prediction mode of the current block and the size of the transform block for the current block. For example, when the intra prediction mode of the current block is DC mode, vertical mode, or 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 more values. For example, if the size of the transform block is 4×4, filtering may not be performed. Alternatively, filtering may be selectively performed based on the result of comparing the difference between the intra prediction mode and the vertical mode (or horizontal mode) of the current block with a predefined threshold. 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. Thresholds may be defined for each size of the transform block as shown in Table 2.
[0169] [Table 2]
[0170] 8×8 transform 16×16 transform 32×32 transform Threshold 7 1 0
[0171] The intra-frame filter may be determined as one of a plurality of intra-frame filter candidates predefined in the apparatus for encoding / decoding video. To this end, an index specifying the intra-frame filter for the current block among the plurality of intra-frame filter candidates may be signaled. Alternatively, the intra-frame 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, and a change in adjacent samples.
[0172] Reference Figure 10 , at step S1020 , intra prediction may be performed using the intra prediction mode and reference samples of the current block.
[0173] That is, the prediction samples of the current block can be obtained using the intra prediction mode determined at step S1000 and the reference samples obtained at step S1010. However, in the case of intra prediction, boundary samples of adjacent blocks may be used, and thus the quality of the predicted picture may be reduced. Therefore, correction processing may be performed on the prediction samples generated by the above prediction processing, and the reference samples may be used. Figures 11 to 13 However, the correction process is not limited to being applied only to intra-predicted samples, and may also be applied to inter-predicted samples or reconstructed samples.
[0174] Figure 11 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.
[0175] The prediction samples of the current block can be corrected based on differential information of multiple adjacent samples of the current block. Correction can be performed on all prediction samples in the current block, or on prediction samples in a predetermined partial area. The partial area can be a row / column or multiple rows / columns, and these areas can be preset areas for correction in a device for encoding / decoding video. For example, correction can be performed on a row / column located at the boundary of the current block, or on multiple rows / columns from the boundary of the current block. Alternatively, the partial area can be variably determined based on at least one of the size / shape of the current block and the intra-frame prediction mode.
[0176] The neighboring samples may belong to neighboring blocks located above, to the left, or at 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 position of the prediction sample that is the correction target in the current block. Alternatively, some neighboring samples may have fixed positions regardless of the position of the prediction sample that is the correction target, and the remaining neighboring samples may have variable positions depending on the position of the prediction sample that is the correction target.
[0177] The difference information of adjacent samples may refer to the difference samples between adjacent samples, or may refer to a value obtained by scaling the difference samples by a predetermined constant value (e.g., one, two, three, etc.). Here, the predetermined constant value may be determined in consideration of the position of the prediction sample as the correction target, the position of the column or row including the prediction sample as the correction target, the position of the prediction sample within the column or row, and the like.
[0178] For example, when the intra prediction mode of the current block is a vertical mode, the differential sample between the adjacent sample p(-1, y) adjacent to the left boundary of the current block and the upper left adjacent sample p(-1, -1) can be used to obtain the final prediction sample, as shown in Equation 1.
[0179] [Formula 1]
[0180] P'(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1where y=0...N-1
[0181] For example, when the intra prediction mode of the current block is the horizontal mode, the differential sample between the adjacent sample p(x, -1) adjacent to the upper boundary of the current block and the upper left adjacent sample p(-1, -1) can be used to obtain the final prediction sample, as shown in Equation 2.
[0182] [Formula 2]
[0183] P′(x, 0)=p(x, 0)+((p(x, -1)-p(-1, -1))>>1where x=0...N-1
[0184] For example, when the intra prediction mode of the current block is a vertical mode, the difference sample between the adjacent sample p(-1, y) adjacent to the left boundary of the current block and the upper left adjacent sample p(-1, -1) can be used to obtain the final prediction sample. 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 used in the scaling can be determined differently according to the column and / or row. For example, the prediction sample can be corrected as shown in Equations 3 and 4.
[0185] [Formula 3]
[0186] P'(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1where y=0...N-1
[0187] [Formula 4]
[0188] P'(1,y)=P(1,y)+((p(-1,y)-p(-1,-1))>>2 where y=0...N-1
[0189] For example, when the intra prediction mode of the current block is a horizontal mode, the difference sample between the adjacent sample p(x, -1) adjacent to the upper boundary of the current block and the upper left adjacent sample p(-1, -1) can be used to obtain the final prediction sample, as described in the case of the vertical mode. For example, the prediction sample can be corrected as shown in Equations 5 and 6.
[0190] [Formula 5]
[0191] P′(x, 0)=p(x, 0)+((p(x, -1)-p(-1, -1))>>1where x=0...N-1
[0192] [Formula 6]
[0193] P′(x, 1)=p(x, 1)+((p(x, -1)-p(-1, -1))>>2where x=0...N-1
[0194] Figure 12 and Figure 13 is a diagram illustrating a method of correcting a prediction sample based on a predetermined correction filter according to an embodiment of the present invention.
[0195] The prediction sample, which is the target of correction, may be corrected based on neighboring samples of the prediction sample and a predetermined correction filter. Here, the neighboring samples may be specified by an angular line of the directional prediction mode of the current block, or may be at least one sample located on the same angular line as the prediction sample, which is the target of correction. Furthermore, the neighboring samples may be prediction samples in the current block, or may be reconstructed samples in a neighboring block reconstructed before the current block.
[0196] At least one of the number of taps, strength, and filter coefficients of the correction filter can be determined based on at least one of the following: the position of the prediction sample as the correction target, whether the prediction sample as the correction target is located at the boundary of the current block, the intra-frame prediction mode of the current block, the angle of the directional prediction mode, the prediction mode of the adjacent block (inter-frame mode or intra-frame mode), and the size / shape of the current block.
[0197] Reference Figure 12 When the directional prediction mode has an index of 2 or an index of 34, a final prediction sample may be obtained using at least one prediction / reconstruction sample located to the lower left of the prediction sample being the correction target and a predetermined correction filter. Here, the prediction / reconstruction sample at the lower left may belong to a line preceding the line including the prediction sample being the correction target. The prediction / reconstruction sample at the lower left may belong to the same block as the current sample, or to a neighboring block adjacent to the current block.
[0198] Filtering of the prediction samples may be performed only on lines located at block boundaries, or may be performed on multiple lines. A correction filter may be used in which at least one of the number of filter taps and the filter coefficients is different for each line. For example, a (1 / 2, 1 / 2) filter may be used for the first line on the left closest to the block boundary, a (12 / 16, 4 / 16) filter may be used for the second line, a (14 / 16, 2 / 16) filter may be used for the third line, and a (15 / 16, 1 / 16) filter may be used for the fourth line.
[0199] Alternatively, when the directional prediction mode has indexes 3 to 6 or indexes 30 to 33, it may be as follows Figure 13 Filtering is performed on block boundaries as shown, and a 3-tap correction filter can be used to correct the prediction samples. Filtering can be performed using the bottom left sample of the prediction sample being the correction target, the sample below the bottom left sample, and a 3-tap correction filter that takes the prediction sample being the correction target as input. The positions of the adjacent samples used by the correction filter can be determined differently based on the directional prediction mode. The filter coefficients of the correction filter can be determined differently depending on the directional prediction mode.
[0200] Different correction filters can be applied depending on whether the adjacent block is coded in inter mode or intra mode. When the adjacent block is coded in intra mode, a filtering method that gives more weight to the prediction samples can be used compared to the case where the adjacent block is coded in inter mode. For example, in the case where the intra prediction mode is 34, when the adjacent block is coded in inter mode, a (1 / 2, 1 / 2) filter can be used, and when the adjacent block is coded in intra mode, a (4 / 16, 12 / 16) filter can be used.
[0201] The number of lines to be filtered in the current block may vary depending on the size / shape of the current block (e.g., coding block or prediction block). For example, if the size of the current block is equal to or less than 32×32, filtering may be performed only on one line at the block boundary; otherwise, filtering may be performed on multiple lines including one line at the block boundary.
[0202] Figure 12 and Figure 13 Based on the use of Figure 7 The present invention is not limited to the case of 35 intra prediction modes in , but can be equally / similarly applied to the case of using the extended intra prediction mode.
[0203] Figure 14 Shown is a range of reference samples used for intra prediction according to an embodiment to which the present invention is applied.
[0204] Intra-frame prediction of the current block can be performed using reference samples obtained based on reconstructed samples included in adjacent blocks. Here, reconstructed samples mean that encoding / decoding is completed before encoding / decoding the current block. For example, intra-frame prediction of the current block can be performed based on at least one reference sample of reference samples P(-1,-1), P(-1,y)(0<=y<=2N-1) and P(x,-1)(0<=x<=2N-1). The prediction samples of the current block can be generated by averaging the reference samples or copying the reference samples in a specific direction considering the directionality of the intra-frame prediction mode of the current block.
[0205] At least one of the plurality of reference lines may be used to perform intra prediction on the current block.All or part of the lengths of the plurality of reference lines may be determined to be the same, or the lengths may be set to be different from each other.
[0206] For example, assuming that the current block has a W×H size, the kth reference line may include: reference samples p(-k, -k), reference samples on the same row as p(-k, -k) (e.g., reference samples from p(-k+1, -k) to p(W+H+2(k-1), -k) or reference samples from p(-k+1, -k) to p(2W+2(k-1), -k))), and reference samples on the same column as p(-k, -k) (e.g., reference samples from p(-k, -k+1) to p(-k, W+H+2(k-1)) or reference samples from p(-k, -k+1) to p(-k, 2H+2(k-1))).
[0207] Figure 15 is a diagram illustrating multiple reference sample lines. Figure 15 As in the example shown in , in a case where the first reference line adjacent to the boundary of the current block is referred to as “reference line 0 ”, the k-th reference line may be configured to be adjacent to the (k−1)-th reference line.
[0208] Alternatively, with Figure 15 Different from what is shown in , the following configuration can be made: all reference lines have the same number of reference samples.
[0209] Intra prediction of the current block may be performed based on reference samples included in at least one reference line selected from a plurality of reference lines. Here, performing intra prediction by selecting at least one of a plurality of reference line candidates may be referred to as an "intra prediction method using extended reference samples (extended reference intra prediction)" or an "extended intra prediction method." Furthermore, a plurality of reference lines may be referred to as "extended reference lines."
[0210] Whether intra prediction is performed based on an extended reference line can be determined based on information signaled via the bitstream. Here, the information can be a 1-bit flag, but is not limited thereto. Information regarding whether intra prediction is performed based on an extended reference line can be signaled in units of coding tree units, coding units, or prediction units, or in units of sequences, pictures, or slices. In other words, whether intra prediction is performed based on an extended reference line can be determined in units of sequences, pictures, slices, CTUs, CUs, or PUs.
[0211] Because intra prediction uses limited reference samples to generate prediction samples, the generated prediction samples may not reflect the characteristics of the original image. In other words, because intra prediction of the current block is performed only using neighboring samples adjacent to the current block, the characteristics of the original image may not be accurately reflected. For example, if there are edges in the current block or new objects appear around the boundary of the current block, the difference between the prediction samples and the original image may be large, depending on the position of the prediction samples in the current block.
[0212] In this case, the residual value becomes relatively large, and the amount of bits to be encoded / decoded may increase. Therefore, the present invention proposes an improved method for generating prediction samples by intra prediction. Figures 16 to 24 The method for modifying the prediction samples is described in detail.
[0213] Figure 16 is a flowchart illustrating a method of modifying a prediction sample according to an embodiment of the present invention.
[0214] First, an intra-frame prediction image (prediction block or prediction sample) of the current block can be obtained based on the intra-frame prediction mode of the current block (S1610). In the following embodiments, the prediction image generated based on the intra-frame prediction mode of the current block is referred to as a first intra-frame prediction image or a first prediction block, and the sample included in the first intra-frame prediction image is referred to as a first prediction sample.
[0215] When a first intra-frame prediction image is generated as a result of performing intra-frame prediction, an offset is applied to at least a portion of the current block to generate a second intra-frame prediction image (or second prediction sample) that is improved from the generated first intra-frame prediction image (or first prediction sample). For example, the improvement of the first intra-frame prediction image based on the offset can be performed on the entire area of the current block, a predefined partial area, or samples at specific positions. The offset used to improve the first intra-frame prediction image into the second intra-frame prediction image can be referred to as an "intra-frame improvement offset."
[0216] Whether to apply the offset to at least a portion of the current block may be determined based on the type of intra-prediction mode of the current block, the directionality of the intra-prediction mode, the angle of the intra-prediction mode, the size or shape of the current block (or prediction block), etc. For example, it may be configured such that when the intra-prediction mode of the current block is a non-directional mode such as a DC mode or a planar mode, the offset is applied to at least a portion of the current block, and when the intra-prediction mode of the current block is a directional mode, the offset is not applied to the current block. As another example, it may be configured such that when the intra-prediction mode of the current block is an intra-prediction mode in a specific direction, the offset is applied to at least a portion of the current block.
[0217] Alternatively, whether to apply the offset to at least a portion of the current block may be determined by information decoded from the bitstream. For example, the syntax 'is_predblock_refinement_flag' indicating whether to use the offset to improve the first intra-frame prediction image may be signaled through the bitstream. When the value of 'is_predblock_refinement_flag' is 1, the offset may be used to perform improvement on the first intra-frame prediction image in the current block, and when the value of 'is_predblock_refinement_flag' is 0, improvement on the first intra-frame prediction image may not be performed in the current block. In the case where improvement of the first intra-frame prediction image is not performed, the first intra-frame prediction image may be output as the final prediction result of the current block.
[0218] In order to apply the offset to at least a partial area of the current block, an offset of the current block may be determined S1620.
[0219] An offset may be defined for each predetermined unit in the current block. Here, the predetermined unit may mean one sample, a line (e.g., a row or a column) including a plurality of samples, a subblock including a plurality of lines, a subblock having a predetermined size, etc. For example, after an offset is defined for each sample in the first intra-frame predicted image, a second intra-frame predicted image may be generated by adding or subtracting the offset corresponding to each sample to or from each sample.
[0220] The offset may be obtained based on a reference sample of the current block. Specifically, the offset may be obtained based on the sum, difference, average, weighted operation value (e.g., weighted average), median, maximum, minimum, etc. of multiple reference samples (e.g., two, three, or more reference samples).
[0221] The reference samples used to obtain the offset may include at least one of the following reference samples: a reference sample at a fixed position, or a reference sample determined depending on the position of the prediction sample (i.e., the sample of the first intra-frame prediction image). For example, the offset may be obtained based on at least one of the following reference samples: a reference sample adjacent to the upper left corner of the current block, and a reference sample on the same vertical line / horizontal line as the prediction sample to which the offset is applied.
[0222] Alternatively, the number and / or position of reference samples used to calculate the offset may be variably determined based on the size, shape, direction, or angle of the intra prediction mode of the current block, etc.
[0223] The offset can be obtained using the reference samples before a filter (e.g., an AIS filter) is applied to the reference samples. That is, the first intra-frame prediction image can be generated using the filtered reference samples, while the second intra-frame prediction image can be generated using the reference samples before the filter is applied to the reference samples.
[0224] The offset may be obtained based on a plurality of reference samples included in the same reference line, or may be obtained based on reference samples each included in a different reference line.
[0225] For example, in Figure 15 In the example shown in , the offset may be determined based on a difference between a value of a reference sample derived from a first reference line and a value of a reference sample derived from one of a second reference line or a fourth reference line.
[0226] Examples of obtaining the intra-frame improvement offset are shown in Equations 7 and 8. The intra-frame improvement offset h may be determined using one of the equations shown in Equation 7.
[0227] [Formula 7]
[0228] h=ref1(i1,j1)-ref0(i0,j0)
[0229] h=ref2(i2,j2)-ref0(i0,j0)
[0230] h=ref3(i3,j3)-ref0(i0,j0)
[0231] h=ref4(i4,j4)-ref0(i0,j0)
[0232] Alternatively, a plurality of intra-frame improvement offsets f0, f1, f2, and f3 may be determined as shown in Equation 8. The current block may be improved based on any one of the plurality of intra-frame improvement offsets f0 to f3, or may be improved by applying different intra-frame improvement offsets in units of predetermined regions.
[0233] [Formula 8]
[0234] f0=w0*(ref1(i1,j1)-rref0(i0,j0))
[0235] f1=w1*(ref2(i2,j2)-ref0(i0,j0))
[0236] f0=w2*(ref3(i3,j3)-ref0(i0,j0))
[0237] f0=w3*(ref4(i4,j4)-ref0(i0,j0))
[0238] In Equations 7 and 8, refn (x=0 to 4) indicates a reference line n. In addition, (i n ,j n ) represents the position of the reference sample included in the reference line n. The value of the reference sample used to obtain the offset can be obtained based on the adjacent reconstructed samples used to perform intra-frame prediction of the current block, or the value of the reference sample used to obtain the offset can represent an independently reconstructed sample used to calculate the offset. Here, the value of the independently reconstructed sample can be obtained based on adjacent samples of the independently reconstructed sample or samples at predefined positions. The value of the reference sample used to obtain the offset can be a value before the loop filter is applied to the adjacent block or a value after the loop filter has been applied to the adjacent block.
[0239] The offset can be obtained by applying a weight to a reference sample. For example, in Equation 8, the offset is obtained by applying a weight w to the difference between the reference samples. In addition, the offset can be obtained by applying a weighted operation with different weights to each reference sample. Here, the weight applied to each reference sample can be determined based on the distance between the sample at a specific position in the current block and the reference line, the distance between the sample at a specific position and the reference sample, the distance between the reference samples, the distance between the reference lines, etc. The sample at the specific position may represent a sample at a predefined position in the current block, or may represent a sample to which an offset is to be applied (hereinafter referred to as an "offset application target sample" or "improved target sample"). The sample at the predetermined position may include at least one of the following samples: a sample adjacent to the left boundary of the current block, a sample adjacent to the upper boundary of the current block, or a sample adjacent to the upper left corner of the current block.
[0240] For example, a weight may be determined in proportion to the distance between a sample at a specific position in the current block and a reference sample used to calculate the offset. For example, assume that the offset is obtained based on a reference sample at the upper left corner of the current block, a reference sample in the vertical direction relative to the offset application target sample, and a reference sample in the horizontal direction relative to the offset application target sample. In this case, the weight applied to the reference sample at the upper left corner of the current block may be obtained using at least one of the x-axis distance difference or the y-axis distance difference between the corresponding reference sample and the offset application target sample. For samples in the vertical direction relative to the offset application target sample, the weight may be obtained based on the y-axis distance difference between the corresponding reference sample and the offset application target sample, and for samples in the horizontal direction relative to the offset application target sample, the weight may be obtained based on the x-axis distance difference between the corresponding reference sample and the offset application target sample.
[0241] Alternatively, the weight may be determined by adding the distance between the sample at a specific position in the current block and the reference sample used to calculate the offset to a predefined value, or subtracting the distance between the sample at a specific position in the current block and the reference sample used to calculate the offset from a predefined value.
[0242] As another example, the weight may be determined based on a ratio between a value indicating a distance between a sample at a specific position in the current block and a reference sample and a value indicating the size of the current block.
[0243] The intra-frame improved offset can be obtained based on the residual samples of the adjacent reconstructed samples (i.e., reference samples) adjacent to the first intra-frame predicted image. Here, the position of the adjacent reconstructed samples can be specified by at least one of the type, direction, or angle of the intra-frame prediction mode used to obtain the first intra-frame predicted image. For example, the position of the adjacent reconstructed samples can be the position of the reference sample located on the angle line of the directional intra-frame prediction mode, or can be located on a line orthogonal to the angle line of the intra-frame prediction mode.
[0244] Alternatively, the offset value may be signaled in units of slices, coding units, or prediction units.
[0245] When the offset is determined, the offset can be applied to the first intra-frame prediction image to generate a second intra-frame prediction image that is an improvement of the first intra-frame prediction image (S1630). For example, the following equation 9 shows an example of obtaining a sample P'(x, y) of the second intra-frame prediction image based on a sample P(x, y) included in the first intra-frame prediction image.
[0246] [Formula 9]
[0247] P′(i, j)=P(i, j)+f
[0248] As shown in Equation 8, the sample P'(i, j) of the second intra-frame prediction image can be obtained by adding the offset f to the sample P(i, j) of the first intra-frame prediction image. In contrast to Equation 9, the second intra-frame prediction image can be obtained by subtracting the offset from the first intra-frame prediction image. Alternatively, the second intra-frame prediction image can be obtained based on a weighted operation of the first intra-frame prediction image and the offset. Here, the weights applied to the first intra-frame prediction image and the offset can be determined according to the position of the sample to be improved, etc.
[0249] In the case of directional intra prediction mode, since prediction samples are generated by copying reference samples adjacent to the current block, prediction efficiency in areas far from the current block may deteriorate. That is, when using directional intra prediction mode, residual values in areas relatively far from the boundary of the current block may include a large amount of high-frequency components, which may lead to degradation of encoding / decoding efficiency.
[0250] In order to solve the above problem, a method for improving the predicted image in units of sub-blocks can be considered. Here, improving the predicted image in units of sub-blocks can mean performing improvement on the predicted image only in an area corresponding to a predetermined sub-block in the entire area of the current block, or defining an offset in units of a predetermined sub-block in the current block (i.e., using a different offset for each sub-block). When improving the predicted image in units of sub-blocks, the accuracy of prediction in areas relatively far from the block boundary can be improved. In the following, with reference to Figure 17 , the method of improving the predicted image in sub-block units will be described in detail.
[0251] Figure 17 is a flowchart illustrating a method for improving a predicted image in units of sub-blocks according to an embodiment of the present invention.
[0252] Reference Figure 17, for the current block, it may be determined whether to refine (or update) the first intra-frame prediction image in units of sub-blocks S1700. Whether to perform the refinement of the first intra-frame prediction image in units of sub-blocks may be determined based on at least one of the size, shape, type, direction, or angle of the current block. Alternatively, whether to refine the first intra-frame prediction image in units of sub-blocks may be determined by a flag decoded from the bitstream. For example, a syntax 'is_sub_block_refinement_flag' indicating whether the first intra-frame prediction image is updated in units of sub-blocks may be signaled through the bitstream. When the value of 'is_sub_block_refinement_flag' is 1, refinement of the first prediction sample using an offset may be performed in a predetermined sub-block in the current block, whereas when the value of 'is_sub_block_refinement_flag' is 0, refinement in units of sub-blocks may not be performed.
[0253] Whether to improve the first intra-frame prediction image and the improvement unit can be determined hierarchically. For example, only when it is determined to perform improvement on the first intra-frame prediction image, it can be determined whether the improvement unit is a subblock unit.
[0254] When it is determined that the improvement of the first intra-frame prediction image is performed in units of subblocks, an intra-frame prediction mode of the current block may be determined (S1710). The intra-frame prediction mode may include the entire region or a partial region of the current block to which the offset is applied, the partition type of the current block, whether the offset is applied to subblocks included in the current block, the size / sign of the offset assigned to each subblock, and the like.
[0255] Any of a plurality of predefined modes in the encoder / decoder may be selectively used for the intra prediction mode of the current block, and to this end, an index specifying the intra prediction mode of the current block may be signaled from the bitstream. As another example, the intra prediction mode of the current block may be determined based on a partitioning mode of a prediction unit or coding unit of the current block, block size / shape, whether it is a directional intra prediction mode, an angle of a directional intra prediction mode, an intra prediction mode of a neighboring block, and the like.
[0256] Whether an index indicating an intra-frame prediction mode for the current block is signaled can be determined by predetermined flag information signaled from a bitstream. For example, when the flag information indicates that an index indicating an intra-frame prediction mode for the current block is signaled from the bitstream, the intra-frame prediction mode for the current block can be determined based on the index decoded from the bitstream. Here, the flag information can be signaled in units of at least one of a picture level, a slice level, or a block level.
[0257] When the flag information indicates that the index indicating the intra prediction mode of the current block is not signaled from the bitstream, the intra prediction mode of the current block may be determined based on a partitioning mode of a prediction unit or a coding unit of the current block, etc. For example, the partitioning type of the current block into subblocks may be the same as the partitioning type of the coding block into prediction units.
[0258] When the intra prediction mode of the current block is determined, an offset may be obtained in units of subblocks (S1720). The offset may be signaled in units of slices, coding units, or prediction units. As another example, the offset may be obtained based on neighboring samples (e.g., reference samples) of the current block. The offset may include at least one of offset size information or offset sign information. Here, the offset size information may be within the range of an integer greater than or equal to zero.
[0259] When the offset is determined, a second intra-frame prediction image can be generated for each sub-block by improving the first intra-frame prediction image (S1730). The second intra-frame prediction image can be obtained by applying the offset to the first intra-frame prediction image. For example, the second prediction sample can be obtained by adding the offset to the first prediction sample or subtracting the offset from the first prediction sample. Here, a different offset can be applied to the first intra-frame prediction image for each sub-block.
[0260] Figures 18 to 22 FIG. 1 is a diagram illustrating an intra prediction method for a current block according to an embodiment to which the present invention is applied.
[0261] For example, in Figure 18 In the example shown, when the index is "0" or "1", the current block is divided into an upper sub-block and a lower sub-block, an offset may not be set for the upper sub-block, and an offset "f" may be set for the lower sub-block. Therefore, the first prediction sample (P(i, j)) can be used as is for the upper sub-block, and the second prediction sample (P(i, j) + f or (P(i, j) - f) generated by adding or subtracting the offset to the first prediction sample can be used for the lower sub-block. In this specification, "not set" may mean that no offset is assigned to the corresponding block, or that an offset of "0" is assigned to the corresponding block.
[0262] When the index is "2" or "3", the current block is divided into a left subblock and a right subblock, an offset may not be set for the left subblock, and an offset "f" is set for the right subblock. Therefore, the first prediction sample (P(i, j)) can be used as is for the left subblock, and a second prediction sample (P(i, j)+f or (P(i, j)-f) generated by adding or subtracting the offset to or from the first prediction sample can be used for the right subblock.
[0263] Based on the intra prediction mode of the current block, available intra prediction methods may be limited in their range. For example, in the case where the intra prediction mode of the current block is a vertical directional intra prediction mode or a prediction mode having a direction similar to that of the vertical directional intra prediction mode (for example, when the intra prediction mode index is 22 to 30 among the 33 directional prediction modes), only the intra prediction methods that horizontally split the current block (for example, Figure 18 Index 0 or index 1 in can be applied to the current block.
[0264] As another example, in the case where the intra prediction mode of the current block is a horizontal directional intra prediction mode or a prediction mode having a direction similar to that of the horizontal directional intra prediction mode (for example, when the intra prediction mode index is 6 to 14 among the 33 directional prediction modes), only the intra prediction manner of vertically splitting the current block (for example, Figure 18 Index 2 or index 3 in can be applied to the current block.
[0265] Alternatively, the intra prediction mode available for the current block may be determined according to whether the intra prediction mode of the current block is a non-directional mode.
[0266] Figure 18 An example is shown in which no offset is set for one of the subblocks included in the current block and an offset is set for the other subblock. Whether to set an offset for a subblock may be determined based on information signaled for each subblock.
[0267] Alternatively, whether to set an offset for a subblock may be determined based on the position of the subblock, an index for identifying a subblock in the current block, or the like. For example, regarding a predetermined boundary of the current block, no offset may be set for subblocks adjacent to the predetermined boundary, while an offset may be set for subblocks not adjacent to the predetermined boundary. Here, the predetermined boundary may be determined based on the size, shape, or intra-prediction mode of the current block.
[0268] When it is assumed that the predetermined boundary is the upper boundary of the current block, for the intra-frame prediction method corresponding to the index "0" or "1", the offset may not be set for the sub-block adjacent to the upper boundary of the current block, and the offset may be set for the sub-block not adjacent to the upper boundary of the current block.
[0269] When it is assumed that the predetermined boundary is the left boundary of the current block, for the intra-frame prediction method corresponding to the index "2" or "3", the offset may not be set for the sub-block adjacent to the left boundary of the current block, and the offset may be set for the sub-block not adjacent to the left boundary of the current block.
[0270] exist Figure 18, it is assumed that no offset is set for one of the sub-blocks included in the current block, and an offset is set for the other sub-block. As another example, an offset having a different value may be set for each sub-block included in the current block.
[0271] Reference Figure 19 , an example of setting a different offset for each sub-block will be described.
[0272] Reference Figure 19 , when the index is "0" or "1", an offset "h" may be set for the upper sub-block in the current block, and an offset "f" may be set for the lower sub-block in the current block. Therefore, a second prediction sample (P(i, j)+h or P(i, j)-h) obtained by adding the offset "h" to the first prediction sample or subtracting the offset "h" from the first prediction sample may be generated for the upper sub-block, and a second prediction sample (P(i, j)+f or P(i, j)-f) obtained by adding the offset "f" to the first prediction sample or subtracting the offset "f" from the first prediction sample may be generated for the lower sub-block.
[0273] Reference Figure 19 When the index is "2" or "3", an offset "h" may be set for the left subblock in the current block, and an offset "f" may be set for the right subblock in the current block. Therefore, a second prediction sample (P(i, j) + h or P(i, j) - h) obtained by adding the offset "h" to the first prediction sample or subtracting the offset "h" from the first prediction sample may be generated for the left subblock, and a second prediction sample (P(i, j) + f or P(i, j) - f) obtained by adding the offset "f" to the first prediction sample or subtracting the offset "f" from the first prediction sample may be generated for the right subblock.
[0274] exist Figure 18 and Figure 19 In the description, the current block is divided into two sub-blocks having the same size, however, the number of sub-blocks included in the current block and / or the size of the sub-blocks are not limited to Figure 18 and Figure 19 The number of sub-blocks included in the current block may be three or more, and each sub-block may have a different size.
[0275] When multiple intra prediction modes are available, the available intra prediction modes may be divided into multiple categories. In this case, the intra prediction mode of the current block may be selected based on a first index for identifying the category and a second index for identifying the intra prediction mode in the corresponding category.
[0276] Reference Figure 20 , an example of determining an intra prediction method of a current block based on a first index and a second index will be described.
[0277] exist Figure 20 In the example shown in , the twelve intra-frame prediction methods can be classified into three categories, each category including four intra-frame prediction methods. For example, the intra-frame prediction methods corresponding to indexes 0 to 3 are classified into category 0, the intra-frame prediction methods corresponding to indexes 4 to 7 are classified into category 1, and the intra-frame prediction methods corresponding to indexes 8 to 11 are classified into category 2.
[0278] The decoder can decode the first index from the bitstream to specify a category including at least one intra prediction mode. Figure 20 In the example shown, the first index may specify any one of categories 0, 1, and 2.
[0279] When a category is specified based on the first index, the intra prediction mode of the current block can be determined based on the second index decoded from the bitstream. When the first index specifies category 1, the second index can specify any one of the four intra prediction modes included in category 1 (i.e., index 4 to index 7).
[0280] exist Figure 20 , each category includes the same number of intra prediction modes, but each category does not necessarily have to include the same number of intra prediction modes.
[0281] The number of available intra prediction methods or the number of categories may be determined in units of a sequence or a slice. In addition, at least one of the number of available intra prediction methods or the number of categories may be signaled through a sequence header or a slice header.
[0282] As another example, the number of available intra prediction modes and / or the number of categories may be determined based on the size of the prediction unit or coding unit of the current block. For example, when the size of the current block (e.g., the coding unit of the current block) is 64×64 or larger, the number of available intra prediction modes and / or categories may be determined based on the size of the prediction unit or coding unit of the current block. Figure 21 Alternatively, when the size of the current block (e.g., the coding unit of the current block) is smaller than 64×64, the intra prediction mode of the current block can be selected from the six intra prediction modes shown in FIG. Figure 18 、 Figure 19 or Figure 20 Select the intra-frame prediction method for the current block from the intra-frame prediction methods shown in .
[0283] exist Figures 18 to 21 In FIG. 5 , it is shown that the sub-blocks included in each intra prediction mode are rectangular. As another example, an intra prediction mode in which at least one of the size or shape of the sub-blocks is different may be used. For example, Figure 22 Examples of intra prediction approaches for subblocks with different sizes and shapes are shown.
[0284] The offset for each sub-block (e.g. Figures 18 to 22 The offset h, f, g or i for each sub-block shown in FIG can be decoded from the bit stream, or can be obtained based on adjacent samples (e.g., reference samples) adjacent to the current block. Figure 16 As described, an offset obtained from at least one reference sample may be used for a sub-block, or an offset obtained from reference samples included in different reference lines (see Equations 7 and 8) may be used for a sub-block.
[0285] As another example, the offset of the sub-block may be determined considering the distance from a sample at a specific position in the current block. For example, the offset may be determined in proportion to a value indicating the distance between a sample at a predetermined position in the current block and a sample at a predetermined position in the sub-block.
[0286] As another example, the offset of the subblock may be determined by adding or subtracting a value to or from a predetermined value, the value being determined based on a distance between a sample at a predetermined position in the current block and a sample at a predetermined position in the subblock.
[0287] As another example, the offset may be determined based on a ratio between a value indicating a distance between a sample at a predetermined position in the current block and a sample at a predetermined position in the subblock and a value indicating the size of the current block.
[0288] Here, the samples at the predetermined position in the current block may include samples adjacent to the left boundary of the current block, samples located at the upper boundary of the current block, samples adjacent to the upper left corner of the current block, and the like.
[0289] In a sub-block, different offsets may be applied in predetermined units. Specifically, different offsets may be applied to each sample in a sub-block, or different offsets may be applied to each line (row or column) or to each plurality of lines.
[0290] Figure 23 and Figure 24 An example of applying different offsets in predetermined units in a sub-block is shown.
[0291] Figure 23 The left figure shows the case where different offsets are applied in units of rows in a sub-block, and the right figure shows an example where different offsets are applied in units of columns in a sub-block. Figure 23 As shown, a different offset can be used for each line, for example, offset f0 for the first line, offset f1 for the second line, offset f2 for the third line, and offset f3 for the fourth line. Here, as described with reference to Equation 8, f0 to f3 can be obtained based on the difference between reference samples each belonging to a different reference line.
[0292] Alternatively, if Figure 24 As shown in , the weight to be applied to the offset can be set differently depending on the position in the sub-block. For example, a different offset can be used for each line, such as an offset h for the first line, an offset 2h for the second line, an offset 3h for the third line, and an offset 4h for the fourth line. Here, as described with reference to Equation 7, h can be obtained based on the difference between reference samples belonging to different reference lines.
[0293] Figure 25 is a flowchart illustrating a process of obtaining residual samples according to an embodiment to which the present invention is applied.
[0294] First, the residual coefficients of the current block can be obtained (step S2510). The decoder can obtain the residual coefficients by a coefficient scanning method. For example, the decoder can perform coefficient scanning using diagonal scanning, zigzag scanning, top right scanning, vertical scanning, or horizontal scanning, and can obtain the residual coefficients in the form of a two-dimensional block.
[0295] Inverse quantization may be performed on the residual coefficients of the current block S2520.
[0296] It may be determined whether to skip inverse transforming the dequantized residual coefficients of the current block (step S2530). Specifically, the decoder may determine whether to skip inverse transforming at least one of the horizontal and vertical directions of the current block. When it is determined that inverse transforming is to be applied to at least one of the horizontal and vertical directions of the current block, residual samples of the current block may be obtained by inverse transforming the dequantized residual coefficients of the current block (step S2540). Here, the inverse transform may be performed using at least one of DCT, DST, and KLT.
[0297] When inverse transform is skipped in both horizontal and vertical directions of the current block, inverse transform is not performed in the horizontal and vertical directions of the current block. In this case, residual samples of the current block can be obtained by scaling the dequantized residual coefficients using a predetermined value S2550.
[0298] Skipping the inverse transform in the horizontal direction means not performing the inverse transform in the horizontal direction but performing the inverse transform in the vertical direction. In this case, scaling can be performed in the horizontal direction.
[0299] Skipping the inverse transform in the vertical direction means not performing the inverse transform in the vertical direction but performing the inverse transform in the horizontal direction. In this case, scaling can be performed in the vertical direction.
[0300] Whether the inverse transform skipping technique can be used for the current block can be determined depending on the partition type of the current block. For example, if the current block is generated by binary tree-based partitioning, the inverse transform skipping scheme can be restricted for the current block. Therefore, when the current block is generated by binary tree-based partitioning, the residual samples of the current block can be obtained by inverse transforming the current block. In addition, when the current block is generated by binary tree-based partitioning, the encoding / decoding of information indicating whether to skip inverse transform (e.g., transform_skip_flag) can be omitted.
[0301] Alternatively, when the current block is generated by binary tree-based partitioning, the inverse transform skip scheme may be limited to at least one of the horizontal direction or the vertical direction. Here, the direction in which the inverse transform skip scheme is limited may be determined based on information decoded from the bitstream, or may be adaptively determined based on at least one of the size of the current block, the shape of the current block, or the intra-frame prediction mode of the current block.
[0302] For example, when the current block is a non-square block with a width greater than a height, the inverse transform skip scheme may be allowed only in the vertical direction and restricted in the horizontal direction. That is, when the current block is 2N×N, inverse transform is performed in the horizontal direction of the current block, and inverse transform may be selectively performed in the vertical direction.
[0303] On the other hand, when the current block is a non-square block with a height greater than a width, the inverse transform skip scheme may be allowed only in the horizontal direction and restricted in the vertical direction. That is, when the current block is N×2N, inverse transform is performed in the vertical direction of the current block, and inverse transform may be selectively performed in the horizontal direction.
[0304] Compared with the above example, when the current block is a non-square block with a width greater than a height, the inverse transform skip scheme may be allowed only in the horizontal direction, and when the current block is a non-square block with a height greater than a width, the inverse transform skip scheme may be allowed only in the vertical direction.
[0305] Information indicating whether to skip inverse transform for the horizontal direction or information indicating whether to skip inverse transform for the vertical direction may be signaled through a bitstream. For example, the information indicating whether to skip inverse transform in the horizontal direction is a 1-bit flag "hor_transform_skip_flag", and the information indicating whether to skip inverse transform in the vertical direction is a 1-bit flag "ver_transform_skip_flag". The encoder may encode at least one of "hor_transform_skip_flag" or "ver_transform_skip_flag" according to the shape of the current block. In addition, the decoder may determine whether to skip inverse transform in the horizontal direction or the vertical direction by using at least one of "hor_transform_skip_flag" or "ver_transform_skip_flag".
[0306] It can be set so that inverse transform of the current block in any direction is skipped depending on the partition type of the current block. For example, if the current block is generated by binary tree-based partitioning, inverse transform in the horizontal direction or the vertical direction can be skipped. That is, if the current block is generated by binary tree-based partitioning, it can be determined that inverse transform of the current block in at least one of the horizontal direction and the vertical direction is skipped without encoding / decoding information indicating whether to skip inverse transform of the current block (e.g., transform_skip_flag, hor_transform_skip_flag, ver_transform_skip_flag).
[0307] Although the above-mentioned embodiment has been described based on a series of steps or flow charts, they do not limit the temporal order of the present invention and can be performed simultaneously or in different orders as needed. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-mentioned embodiment can be realized by hardware devices or software and multiple components. Alternatively, multiple components can be combined and realized by a single hardware device or software. The above-mentioned embodiment can be realized in the form of program instructions, which can be executed and recorded in a computer-readable recording medium by various computer components. The computer-readable recording medium can include one of program commands, data files, data structures, etc. or a combination thereof. The example of a computer-readable medium includes magnetic media such as hard disks, floppy disks and tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as optical magnetic floppy disks, media, and hardware devices such as ROM, RAM, flash memory, etc. that are specially configured to store and execute program instructions. The hardware device can be configured to operate as one or more software modules for performing processing according to the present invention, and vice versa.
[0308] Industrial Applicability
[0309] The present invention can be applied to electronic devices capable of encoding / decoding videos.
[0310] The present technology may also be configured as follows.
[0311] (1) A method for decoding a video, comprising:
[0312] determining an intra prediction mode for a current block;
[0313] Obtaining a reference sample according to adjacent samples of the current block;
[0314] Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample;
[0315] determining an offset of the first prediction sample; and
[0316] A second prediction sample is obtained by applying the offset to the first prediction sample.
[0317] (2) The method according to (1), wherein:
[0318] Whether to apply the offset to the first prediction sample is determined based on the intra prediction mode of the current block.
[0319] (3) The method according to (1), wherein:
[0320] The offset is determined based on a weighted sum of the reference samples.
[0321] (4) The method according to (3), wherein:
[0322] A weight applied to each of the reference samples is determined based on a distance from the first prediction sample.
[0323] (5) The method according to (3), wherein:
[0324] The reference samples include: reference samples at fixed positions and reference samples determined depending on the position of the first prediction sample.
[0325] (6) The method according to (5), wherein:
[0326] The reference samples at the fixed position include reference samples adjacent to the upper left corner of the current block, and
[0327] The reference sample determined depending on the position of the first prediction sample includes at least one of the following reference samples: a reference sample on the same horizontal line as the first prediction sample, or a reference sample on the same vertical line as the first prediction sample.
[0328] (7) The method according to (3), wherein:
[0329] Each of the reference samples is included in a different reference line.
[0330] (8) A method for encoding a video, comprising:
[0331] determining an intra prediction mode for a current block;
[0332] Obtaining a reference sample according to adjacent samples of the current block;
[0333] Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample;
[0334] determining an offset of the first prediction sample; and
[0335] A second prediction sample is obtained by applying the offset to the first prediction sample.
[0336] (9) The method according to (8), wherein:
[0337] Whether to apply the offset to the first prediction sample is determined based on the intra prediction mode of the current block.
[0338] (10) The method according to (8), wherein:
[0339] The offset is determined based on a weighted sum of the reference samples.
[0340] (11) The method according to (10), wherein:
[0341] A weight applied to each of the reference samples is determined based on a distance from the first prediction sample.
[0342] (12) The method according to (11), wherein:
[0343] The reference samples include: reference samples at fixed positions and reference samples determined depending on the position of the first prediction sample.
[0344] (13) The method according to (12), wherein:
[0345] The reference samples at the fixed position include reference samples adjacent to the upper left corner of the current block, and
[0346] The reference sample determined depending on the position of the first prediction sample includes at least one of the following reference samples: a reference sample on the same horizontal line as the first prediction sample, or a reference sample on the same vertical line as the first prediction sample.
[0347] (14) The method according to (11), wherein:
[0348] Each of the reference samples is included in a different reference line.
[0349] (15) A device for decoding a video, comprising:
[0350] An intra prediction unit configured to:
[0351] determining an intra prediction mode for a current block;
[0352] Obtaining a reference sample according to adjacent samples of the current block;
[0353] Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample;
[0354] determining an offset of the first prediction sample; and
[0355] A second prediction sample is obtained by applying the offset to the first prediction sample.
Claims
1. A method for decoding a video, comprising: Determining an intra prediction mode for a current block based on a candidate list, the candidate list including a plurality of candidates, the plurality of candidates being determined based on intra prediction modes of neighboring blocks adjacent to the current block; Obtaining reference samples for intra prediction of the current block from adjacent samples adjacent to the current block; Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample; determining an offset for modifying the first prediction sample; as well as obtaining a second prediction sample by modifying the first prediction sample based on the offset, The offset is obtained based on at least one reference sample among the reference samples, wherein the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a non-directional mode, and The non-directional mode includes a DC mode.
2. The method according to claim 1, wherein: Whether to modify the first prediction sample using the offset is determined based on whether the intra prediction mode of the current block is one of predefined intra prediction modes.
3. The method according to claim 1, wherein: When a plurality of reference samples are used to obtain the offset, the offset is obtained based on a weighted sum of the plurality of reference samples, and Weights applied to the plurality of reference samples are adaptively determined based on the coordinates of the first prediction sample and a variable obtained based on the size of the current block.
4. The method according to claim 3, wherein: The multiple reference samples include: a first reference sample located on the same horizontal line as the first prediction sample, or a second reference sample located on the same vertical line as the first prediction sample.
5. A method for encoding a video, comprising: Determining an intra prediction mode of a current block based on a candidate list, the candidate list including a plurality of candidates, the plurality of candidates being determined based on intra prediction modes of neighboring blocks adjacent to the current block; Obtaining reference samples for intra prediction of the current block from adjacent samples adjacent to the current block; Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample; determining an offset for modifying the first prediction sample; as well as obtaining a second prediction sample by modifying the first prediction sample based on the offset, wherein the offset is obtained based on at least one reference sample among the reference samples, and wherein the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a non-directional mode, and The non-directional mode includes a DC mode.
6. The method according to claim 5, wherein: Whether to modify the first prediction sample using the offset is determined based on whether the intra prediction mode of the current block is one of predefined intra prediction modes.
7. The method according to claim 5, wherein: When a plurality of reference samples are used to obtain the offset, the offset is obtained based on a weighted sum of the plurality of reference samples, and Weights applied to the plurality of reference samples are adaptively determined based on the coordinates of the first prediction sample and a variable obtained based on the size of the current block.
8. The method according to claim 7, wherein: The multiple reference samples include: a first reference sample located on the same horizontal line as the first prediction sample, or a second reference sample located on the same vertical line as the first prediction sample.
9. A method for transmitting video data, comprising: Determining an intra prediction mode of a current block based on a candidate list, the candidate list including a plurality of candidates, the plurality of candidates being determined based on intra prediction modes of neighboring blocks adjacent to the current block; Obtaining reference samples for intra prediction of the current block from adjacent samples adjacent to the current block; Obtaining a first prediction sample of the current block based on the intra prediction mode and the reference sample; determining an offset for modifying the first prediction sample; obtaining a second prediction sample by modifying the first prediction sample based on the offset; encoding the current block based on the second prediction sample to generate a bitstream; as well as transmitting said video data comprising said bitstream, wherein the offset is obtained based on at least one reference sample among the reference samples, and wherein the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a directional mode is different from the number of reference samples used to obtain the offset when the intra prediction mode of the current block is a non-directional mode, and The non-directional mode includes a DC mode.
Citation Information
Patent Citations
Method and device for encoding / decoding image using bi-directional intra prediction
CN103329538A