Method and apparatus for processing a video signal
By combining intra and inter prediction modes in video signal encoding/decoding, the final prediction block of the video signal is generated, and the problem of difficulty in effectively predicting the encoding/decoding target block in the prior art is solved, and efficient video signal prediction encoding/decoding is achieved.
Patent Information
- Application Number
- CN202210174672.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2016-07-05
- Filing Date
- 2017-06-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2037-06-30
AI Technical Summary
When encoding/decoding a video signal, it is difficult to effectively predict the encoding/decoding target block, and it is difficult for the prior art to combine multiple prediction modes to improve the prediction effect.
By generating the final prediction block of the current block based on the first prediction mode and the second prediction mode, the specific method includes a combination of the intra prediction mode and the inter prediction mode, and generating the final prediction block through weighting sum operation.
Efficient prediction encoding/decoding of video signals is realized, and multiple prediction modes can be effectively combined to improve encoding/decoding quality.
Smart Images

Figure CN114401401B_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese invention patent application with application number 201780041685.6, application date June 30, 2017, and invention name “Method and device for processing video signals”. Technical Field
[0002] The present invention relates to a method and an 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 data volume of image data with higher resolution and quality has increased compared to conventional image data. Therefore, when the image data is transmitted by using a medium such as a conventional wired and wireless broadband network or when the image data is stored by using a conventional storage medium, the cost of transmission and storage increases. In order to solve these problems arising as the resolution and quality of image data increase, efficient image encoding / decoding technology can be used.
[0004] Image compression technology includes various technologies, including: inter-frame prediction technology for predicting pixel values included in a current picture based on a previous picture or a subsequent picture of the current picture; intra-frame prediction technology for predicting pixel values included in the current picture by using pixel information in the current picture; entropy coding technology for assigning short codes to values with high frequency of occurrence and long codes to values with low frequency of occurrence, etc. Image data can be effectively compressed by using such image compression technology, and the image data can be transmitted or stored.
[0005] Meanwhile, 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 studied. Summary of the invention
[0006] Technical issues
[0007] An object of the present invention is to provide a method and apparatus for effectively predicting a coding / decoding target block when coding / decoding a video signal.
[0008] An object of the present invention is to provide a prediction method for combining a plurality of prediction modes when encoding / decoding a video signal and a device using the prediction method.
[0009] An object of the present invention is to provide a method and apparatus for performing prediction in sub-block units when encoding / decoding a video signal.
[0010] The technical objectives to be achieved by the present invention are not limited to the above-mentioned technical problems, and those skilled in the art will clearly understand other technical problems not mentioned from the following description.
[0011] Technical Solution
[0012] The method and apparatus for decoding a video signal according to the present invention can generate a first prediction block of a current block based on a first prediction mode, generate a second prediction block of the current block based on a second prediction mode, and generate a final prediction block of the current block based on the first prediction block and the second prediction block.
[0013] The method and apparatus for encoding a video signal according to the present invention can generate a first prediction block of a current block based on a first prediction mode, generate a second prediction block of the current block based on a second prediction mode, and generate a final prediction block of the current block based on the first prediction block and the second prediction block.
[0014] In the method and apparatus for encoding / decoding a video signal according to the present invention, the first prediction mode may be different from the second prediction mode.
[0015] In the method and apparatus for encoding / decoding a video signal according to the present invention, the first prediction mode may be an intra prediction mode, and the second prediction mode may be an inter prediction mode.
[0016] In a method and apparatus for encoding / decoding a video signal according to the present invention, the first prediction mode may be an inter-prediction mode different from the second prediction mode, and the inter-prediction mode may include at least one of a skip mode, a merge mode, an AMVP (Advanced Motion Vector Prediction) mode, or a current picture reference mode.
[0017] In the method and apparatus for encoding / decoding a video signal according to the present invention, the final prediction block may be obtained based on a weighted sum operation between the first prediction block and the second prediction block.
[0018] In the method and apparatus for encoding / decoding a video signal according to the present invention, weights applied to the first prediction block and the second prediction block may be determined based on a weighted prediction parameter of the current block.
[0019] In the method and apparatus for encoding / decoding a video signal according to the present invention, whether to use a prediction method combining a first prediction mode and a second prediction mode may be determined based on a shape or a size of a current block.
[0020] In the method and apparatus for encoding / decoding a video signal according to the present invention, the current block may include a first subblock and a second subblock, a final prediction block of the first subblock may be generated based on the first prediction block, and a final prediction block of the second subblock may be generated based on the first prediction block and the second prediction block.
[0021] The features briefly summarized above with respect to the present invention are merely illustrative aspects of the detailed description of the invention that follows and do not limit the scope of the invention.
[0022] Beneficial Effects
[0023] According to the present invention, it is possible to efficiently predict an encoding / decoding target block.
[0024] According to the present invention, an encoding / decoding target block can be predicted by combining a plurality of prediction modes.
[0025] According to the present invention, a prediction method may be determined in units of subblocks, and prediction may be performed in units of subblocks.
[0026] 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
[0027] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0028] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0029] Figure 3 is a diagram showing an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0030] Figure 4 is a diagram showing partition types that allow binary tree-based partitioning according to an embodiment of the present invention.
[0031] Figure 5 is a diagram showing an example of allowing only a predetermined type of binary tree-based partitioning according to an embodiment of the present invention.
[0032] Figure 6 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.
[0033] Figure 7 is a diagram showing a partitioning pattern applicable to a coding block according to an embodiment of the present invention.
[0034] Figure 8 is a flowchart showing a process of obtaining residual samples according to an embodiment to which the present invention is applied.
[0035] Fig. 9 is a flowchart showing an inter-frame prediction method according to an embodiment to which the present invention is applied.
[0036] Fig.10 is a diagram showing a process of obtaining motion information of a current block when a merge mode is applied to the current block.
[0037] Fig.11 is a diagram showing a process of obtaining motion information of a current block when the AMVP mode is applied to the current block.
[0038] Fig.12 4 is a flowchart of a bidirectional weighted prediction method according to an embodiment of the present invention.
[0039] Fig.13 This is a diagram for explaining the principle of bidirectional weighted prediction.
[0040] Fig.14 is a diagram showing the scanning order between adjacent blocks.
[0041] Fig.15 is a flow chart showing a combined prediction method according to the present invention.
[0042] Fig.16 and Fig.17 is a diagram showing an example of generating a prediction block of a current block based on a weighted sum of a plurality of prediction blocks obtained through different prediction modes.
[0043] Fig.18 is a diagram showing an example of performing prediction in units of sub-blocks.
[0044] Fig.19 is a flow chart of a method for illumination compensation prediction according to the present invention.
[0045] Fig. 20 It is a flow chart of a bidirectional weighted prediction method based on illumination compensation.
[0046] Fig.21 is a diagram showing an example of performing bidirectional weighted prediction using a prediction block to which illumination compensation is applied. DETAILED DESCRIPTION
[0047] The present invention can be modified in various ways, and there are various embodiments of the present invention, and examples of the embodiments will now be provided with reference to the accompanying drawings, and these examples 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 described drawings, similar reference numerals refer to similar elements.
[0048] The terms "first", "second", etc. 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 only used to distinguish one component from other components. For example, without departing from the scope of the present invention, a "first" component may be referred to as a "second" component, and a "second" component may also be similarly referred to as a "first" component. The term "and / or" includes a combination of any one of a plurality of terms or a plurality of terms.
[0049] 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" another element, or the element may be connected or coupled to another 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.
[0050] The terms used in this specification are only used to describe specific embodiments and are not intended to limit the present invention. Expressions used in the singular include expressions in the plural form unless the expression has a significantly different meaning in the context. In this specification, it should be understood that terms such as "including", "having" and the like 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.
[0051] 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.
[0052] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0053] Reference Figure 1, the device 100 for encoding a video may include: a picture division module 110, prediction modules 120 and 125, a transformation module 130, a quantization module 135, a rearrangement module 160, an entropy coding module 165, an inverse quantization module 140, an inverse transformation module 145, a filter module 150 and a memory 155.
[0054] Figure 1 The components shown in are shown independently to represent the characteristic functions that are different from each other in the device for encoding the video. Therefore, it does not mean that each component is composed of separate hardware or software components. In other words, for convenience, each component includes each of the listed components. Therefore, at least two components in each component can be combined to form a component, or a component can be divided into multiple components to perform each function. Without departing from the essence of the present invention, the embodiment of combining each component and the embodiment of dividing a component are also included in the scope of the present invention.
[0055] In addition, some of the components may not be indispensable components for performing the basic functions of the present invention, but optional components only for improving the performance of the present invention. The present invention can be realized by excluding components for improving performance and only including indispensable components for realizing the essence of the present invention. Structures that exclude optional components only for improving performance and only include indispensable components are also included in the scope of the present invention.
[0056] The picture partitioning module 110 may partition an input picture into one or more processing units. Here, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture partitioning module 110 may partition a picture into a combination of a plurality of coding units, prediction units, and transform units, and may encode a picture by selecting a combination of coding units, prediction units, and transform units using a predetermined criterion (e.g., a cost function).
[0057] 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. Coding units divided into other coding units with a picture or a maximum coding unit as the root can be divided in a manner that the child nodes correspond to the number of divided coding units. Coding units that cannot be further divided according to predetermined restrictions are used as leaf nodes. That is, when it is assumed that only square division is feasible for a coding unit, a coding unit can be divided into up to four other coding units.
[0058] Hereinafter, in an embodiment of the present invention, a coding unit may mean a unit that performs encoding or a unit that performs decoding.
[0059] The prediction unit may be one of partitions split into square shapes or rectangular shapes having the same size in a single coding unit, or the prediction unit may be one of partitions split into different shapes / sizes in a single coding unit.
[0060] 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.
[0061] The prediction modules 120 and 125 may include an inter-frame prediction module 120 that performs inter-frame prediction and an intra-frame prediction module 125 that performs intra-frame prediction. It may be determined whether to perform inter-frame prediction or intra-frame prediction for the prediction unit, and detailed information (e.g., intra-frame prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. Here, the processing unit to be predicted may be different from the processing unit for which the prediction method and detailed content are determined. For example, the prediction method, prediction mode, etc. may be determined by the prediction unit, and the prediction may be performed by the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform module 130. In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value by the entropy encoding module 165, and may be transmitted to a device for decoding a video. When a specific encoding mode is used, the original block may be encoded as it is and transmitted to a device for decoding a video without generating a prediction block through the prediction modules 120 and 125.
[0062] The inter-frame prediction module 120 may predict a prediction unit based on information of at least one of a previous picture or a subsequent picture of the current picture, or in some cases, may predict a prediction unit based on information of some coding regions in the current picture. The inter-frame prediction module 120 may include a reference picture interpolation module, a motion prediction module, and a motion compensation module.
[0063] The reference picture interpolation module may receive reference picture information from the memory 155, and may generate pixel information of integer pixels or less than integer pixels according to the reference picture. In the case of luma pixels, an 8-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 4 pixels. In the case of chrominance signals, a 4-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 8 pixels.
[0064] 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 such as a full search based block matching algorithm (FBMA), a three-step search (TSS), and a new three-step search algorithm (NTS) can be used. 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 a motion prediction method, various methods such as a skip method, a merge method, an AMVP (Advanced Motion Vector Prediction) method, an intra-frame block copy method, etc. can be used.
[0065] The intra prediction module 125 may generate a prediction unit based on reference pixel information adjacent to a current block as pixel information in a current picture. When an adjacent block of the current prediction unit is a block to be inter-predicted and thus a reference pixel is a pixel to be inter-predicted, reference pixel information of an adjacent block to be intra-predicted may be used to replace the reference pixel included in the block to be inter-predicted. That is, when a reference pixel is unavailable, at least one reference pixel among available reference pixels may be used to replace the unavailable reference pixel information.
[0066] The prediction mode in the intra prediction may include a directional prediction mode using reference pixel information according to a prediction direction and a non-directional prediction mode that does not use directional information when performing prediction. The mode for predicting luminance information may be different from the mode for predicting chrominance information, and in order to predict chrominance information, the intra prediction mode information for predicting luminance information may be utilized or the predicted luminance signal information may be utilized.
[0067] When performing intra prediction, when the size of the prediction unit is the same as the size of the transform unit, intra prediction can be performed on the prediction unit based on pixels located on the left, upper left, and upper sides of the prediction unit. However, when performing intra prediction, when the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using N×N partitioning only for the minimum coding unit can be used.
[0068] In the intra prediction method, a prediction block may be generated after applying an AIS (Adaptive Intra Smoothing) filter to a reference pixel according to a prediction mode. The type of the AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted according to the intra prediction mode of a prediction unit adjacent to the current prediction unit. In the process of predicting the prediction mode of the current prediction unit by using the mode information predicted according to the adjacent prediction unit, when the intra prediction mode of the current prediction unit is the same as the intra prediction mode of the adjacent prediction unit, predetermined marking information may be used to transmit information indicating that the prediction mode of the current prediction unit and the prediction mode of the adjacent prediction unit are the same as each other. When the prediction mode of the current prediction unit is different from the prediction mode of the adjacent prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.
[0069] In addition, a residual block including information on a residual value that is a difference between a prediction unit to be predicted and an 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.
[0070] The transform module 130 may transform the residual block including information on the residual value between the original block and the prediction unit generated by the prediction modules 120 and 125 by using a transform method such as discrete cosine transform (DCT), discrete sine transform (DST), and KLT. Whether to apply DCT, DST, or KLT to transform the residual block may be determined based on intra prediction mode information of the prediction unit used to generate the residual block.
[0071] The quantization module 135 may quantize the value transformed to the frequency domain by the transform module 130. The quantization coefficient may vary according to the block or importance of the picture. The value calculated by the quantization module 135 may be provided to the inverse quantization module 140 and the rearrangement module 160.
[0072] The rearrangement module 160 may rearrange coefficients of the quantized residual value.
[0073] The rearrangement module 160 can change the coefficients of the two-dimensional block form into the coefficients of the one-dimensional vector form by the coefficient scanning method. For example, the rearrangement module 160 can use a zigzag scanning method to scan from the DC coefficient to the coefficient of the high frequency domain to change the coefficient into the one-dimensional vector form. According to the size of the transform unit and the intra-frame prediction mode, the zigzag scanning can be replaced by the vertical direction scanning of the coefficients of the two-dimensional block form along the column direction or the horizontal direction scanning of the coefficients of the two-dimensional block form along the row direction. That is to say, it can be determined according to the size of the transform unit and the intra-frame prediction mode which scanning method to use among the zigzag scanning, the vertical direction scanning and the horizontal direction scanning.
[0074] 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, for example, exponential Golomb coding, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC).
[0075] The entropy coding module 165 can encode various information such as residual value coefficient information and block type information of the coding unit, prediction mode information, partition unit information, prediction unit information, transformation unit information, motion vector information, reference frame information, block interpolation information, filtering information, etc. from the rearrangement module 160 and the prediction modules 120 and 125.
[0076] The entropy encoding module 165 may entropy encode coefficients of the coding unit input from the rearrangement module 160 .
[0077] 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.
[0078] The filter module 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0079] The deblocking filter can remove block distortion that occurs due to the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, the pixels included in several rows or columns of the block can be the basis for determining whether to apply the deblocking filter to the current block. When the deblocking filter is applied to the block, a strong filter or a weak filter can be applied according to the required deblocking filter strength. In addition, when applying the deblocking filter, horizontal direction filtering and vertical direction filtering can be processed in parallel.
[0080] The offset correction module can correct the offset from the original picture in units of pixels for the picture to be deblocked. In order to perform offset correction on a specific picture, a method of applying an offset considering edge information of each pixel can be used, or the following method can be used: the pixels of the picture are divided into a predetermined number of regions, the region to be offset is determined, and the offset is applied to the determined region.
[0081] Adaptive loop filtering (ALF) can be performed based on a value obtained by comparing a filtered reconstructed picture with an original picture. The pixels included in the picture can be divided into predetermined groups, 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 a luminance signal can be transmitted by a coding unit (CU). The shape and filter coefficients of the filter used for ALF can be different for each block. In addition, regardless of the characteristics of the application target block, the filter for ALF of the same shape (fixed shape) can be applied.
[0082] 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.
[0083] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0084] 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 .
[0085] 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.
[0086] The entropy decoding module 210 can perform entropy decoding according to the inverse process of entropy encoding performed by the entropy encoding module of the device for encoding the video. For example, corresponding to the method performed by the device for encoding the video, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC) and context adaptive binary arithmetic coding (CABAC) can be applied.
[0087] The entropy decoding module 210 may decode information about intra prediction and inter prediction performed by the apparatus for encoding a video.
[0088] The rearrangement module 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding module 210 based on the rearrangement method used in the apparatus for encoding a video. The rearrangement module may reconstruct and rearrange coefficients in the form of a one-dimensional vector into coefficients in the form of a two-dimensional block. The rearrangement module 215 may receive information related to coefficient scanning performed in the apparatus for encoding a video, and may perform rearrangement via a method of inversely scanning the coefficients based on the scanning order performed in the apparatus for encoding a video.
[0089] 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.
[0090] The inverse transform module 225 may perform an inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, which is an inverse process of the transform performed by the transform module on the quantization result of the device for encoding the video, i.e., DCT, DST, and KLT. The inverse transform may be performed based on a transmission unit determined by the device for encoding the video. The inverse transform module 225 of the device for decoding the video may selectively perform a transform scheme (e.g., DCT, DST, KLT) according to a plurality of pieces of information (e.g., a prediction method, a size of a current block, a prediction direction, etc.).
[0091] The prediction modules 230 and 235 may generate a prediction block based on information on the prediction block generation received from the entropy decoding module 210 and picture information received from the memory 245 or a previously decoded block.
[0092] As described above, similar to the operation of the apparatus for encoding a 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 on 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 only for the minimum coding unit can be used.
[0093] The prediction modules 230 and 235 may include a prediction unit determination module, an inter-frame prediction module, and an intra-frame prediction module. The prediction unit determination module may receive various information such as prediction unit information, prediction mode information of an intra-frame prediction method, information about motion prediction of an inter-frame prediction method, etc. from the entropy decoding module 210, may divide the current coding unit into prediction units, and may determine whether to perform inter-frame prediction or intra-frame prediction on the prediction unit. By using the information required for inter-frame prediction of the current prediction unit received from the device for encoding a video, the inter-frame prediction module 230 may perform inter-frame prediction on the current prediction unit based on information of at least one of a previous picture or a subsequent picture of the current picture including the current prediction unit. Alternatively, inter-frame prediction may be performed based on information of some pre-reconstructed areas in the current picture including the current prediction unit.
[0094] In order to perform inter prediction, which 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 a coding unit.
[0095] 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 it can be determined whether to apply the filter according to the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixels of the current block by using the 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.
[0096] 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 may interpolate the reference pixels to generate reference pixels that are integer pixels or smaller than integer pixels. When the prediction mode of the current prediction unit is a prediction mode 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 a DC mode, the DC filter may generate a prediction block by filtering.
[0097] 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.
[0098] Information about whether to apply a deblocking filter to a corresponding block or picture and information about which filter of a strong filter and a weak filter to apply when applying the deblocking filter can be received from a device for encoding a video. The deblocking filter of a device for decoding a video can receive information about the deblocking filter from a device for encoding a video, and can perform deblocking filtering on the corresponding block.
[0099] The offset correction module may perform offset correction on the reconstructed picture based on the type of offset correction applied to the picture when encoding is performed and offset value information.
[0100] The AFL may be applied to the coding unit based on information on whether the ALF is applied, ALF coefficient information, etc. received from the apparatus for encoding a video. The ALF information may be provided to be included in a specific parameter set.
[0101] 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.
[0102] As described above, in the embodiments of the present invention, for convenience of explanation, a coding unit is used as a term indicating a unit for encoding, however, the coding unit may be used as a unit that performs decoding as well as encoding.
[0103] In addition, the current block may represent a target block to be encoded / decoded. Also, the current block may represent a coding tree block (or coding tree unit), a coding block (or coding unit), a transform block (or transform unit), a prediction block (or prediction unit), etc. according to the encoding / decoding steps.
[0104] The picture can be encoded / decoded by dividing the picture into basic blocks having a square shape or a non-square shape. At this time, the basic block can be referred to as a coding tree unit. The coding tree unit can be defined as a coding unit of the maximum size allowed within a sequence or slice. Information 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 by a sequence parameter set, a picture parameter set, or a slice header. The coding tree unit can be divided into smaller size partitions. At this time, if it is assumed that the depth of the partition generated by splitting the coding tree unit is 1, the depth of the partition generated by splitting the partition with a depth of 1 can be defined as 2. That is, the partition generated by splitting the partition with a depth of k in the coding tree unit can be defined as having a depth of k+1.
[0105] 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 partitioned into a basic unit for performing prediction, quantization, transformation, or in-loop filtering, etc. For example, a partition of any size generated by splitting a coding unit may be defined as a coding unit, or may be defined as a transformation unit or a prediction unit, which is a basic unit for performing prediction, quantization, transformation, or in-loop filtering, etc.
[0106] 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 the coding tree unit or the coding unit 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 of 1 / 2 in length and 1 / 2 in width by using one vertical line and one horizontal line.
[0107] 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.
[0108] 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.
[0109] Figure 3 is a diagram showing an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0110] The input video signal is decoded in units of predetermined blocks. Such a default unit for decoding the input video signal is a coding block. A coding block may be a unit that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., an intra prediction mode or an inter prediction mode) is determined in units of coding blocks, and the prediction blocks included in the coding block may share the determined prediction mode. A coding block may be a square block or a non-square block 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.
[0111] Specifically, the coding block may be hierarchically divided based on at least one of a quadtree and a binary tree. Here, the quadtree-based division may mean dividing a 2N×2N coding block into four N×N coding blocks, and the binary tree-based division may mean dividing one coding block into two coding blocks. Although the binary tree-based division is performed, a square-shaped coding block may exist in a lower depth.
[0112] The binary tree-based partitioning may be performed symmetrically or asymmetrically. The coding block based on the binary tree partitioning may be a square block or a non-square block such as a rectangular shape. For example, the partitioning type allowed based on the binary tree partitioning may include at least one of the symmetric type of 2N×N (non-square coding unit in the horizontal direction) or N×2N (non-square coding unit in the vertical direction), the asymmetric type of nL×2N, nR×2N, 2N×nU or 2N×nD.
[0113] Binary tree-based partitioning may restrictively allow one of symmetric type partitioning or asymmetric type partitioning. In this case, constructing a coding tree unit with square blocks may correspond to quadtree CU partitioning, while constructing a coding tree unit with symmetrical non-square blocks may correspond to binary tree partitioning. Constructing a coding tree unit with square blocks and symmetrical non-square blocks may correspond to quadtree CU partitioning and binary tree CU partitioning.
[0114] Binary tree-based partitioning may be performed on a coding block for which quadtree-based partitioning can no longer be performed. Quadtree-based partitioning may no longer be performed on a coding block partitioned based on a binary tree.
[0115] In addition, the partitioning of the lower depth can be determined according to the partitioning type of the upper depth. For example, if binary tree-based partitioning is allowed in two or more depths, only the type of binary tree partitioning in the lower depth can be allowed to be the same as the type of binary tree partitioning in the upper depth. For example, if the binary tree-based partitioning in the upper depth is performed using the 2N×N type, the binary tree-based partitioning in the lower depth is also performed using the 2N×N type. Alternatively, if the binary tree-based partitioning in the upper depth is performed using the N×2N type, the binary tree-based partitioning in the lower depth is also performed using the N×2N type.
[0116] Conversely, it is also possible to allow only the type of binary tree partitioning in the lower depth to be different from the type of binary tree partitioning in the upper depth.
[0117] Only certain types of binary tree-based partitions may be restricted for use in sequences, slices, coding tree units, or coding units. As an example, for a coding tree unit, only 2N×N type of binary tree-based partitions or N×2N type of binary tree-based partitions may be allowed. Available partition types may be predefined in an encoder or decoder. Alternatively, information about available partition types or unavailable partition types may be encoded and then signaled through the bitstream.
[0118] Figure 5 is a diagram showing an example in which only certain types of binary tree-based partitioning are allowed. Figure 5 The upper part of shows an example of binary tree-based partitioning that only allows N×2N types, Figure 5 The lower part of shows an example in which only 2N×N type of binary tree-based partitioning is allowed. In order to implement quadtree-based or binary tree-based adaptive partitioning, information indicating quadtree-based partitioning, information about the size / depth of the coding block for which quadtree-based partitioning is allowed, information indicating binary tree-based partitioning, information about the size / depth of the coding block for which binary tree-based partitioning is allowed, information about the size / depth of the coding block for which binary tree-based partitioning is not allowed, information about whether binary tree-based partitioning is performed in a vertical direction or a horizontal direction, etc. may be used.
[0119] In addition, information about the number of times binary tree division is allowed, the depth of binary tree division is allowed, or the number of depths of binary tree division is allowed can be obtained for a coding tree unit or a specific coding unit. This information can be encoded in units of coding tree units or coding units, and can be transmitted to a decoder through a bitstream.
[0120] For example, the syntax "max_binary_depth_idx_minus1" indicating the maximum depth allowed for binary tree partitioning may be encoded / decoded through a bitstream. In this case, "max_binary_depth_idx_minus1+1" may indicate the maximum depth allowed for binary tree partitioning.
[0121] refer to Figure 6 The example shown in Figure 6 , binary tree partitioning 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 the following information may be encoded / decoded through the bitstream: information indicating the number of times binary tree partitioning has been performed in the coding tree unit (i.e., 2 times), information indicating the maximum depth at which binary tree partitioning has been allowed in the coding tree unit (i.e., the depth is 3), or information on the number of depths at which binary tree partitioning has been performed in the coding tree unit (i.e., 2 (depth 2 and depth 3)).
[0122] As another example, at least one of the information about the number of times binary tree divisions are allowed, the depth of binary tree divisions allowed, or the number of depths of binary tree divisions allowed may be obtained for each sequence or each slice. For example, the information may be encoded in units of sequence units, picture units, or slice units, and transmitted via a bitstream. Therefore, at least one of the number of binary tree divisions in the first slice, the maximum depth of binary tree divisions allowed in the first slice, or the number of depths at which binary tree divisions are performed in the first slice may be different from that in the second slice. For example, in the first slice, only one depth of binary tree division may be allowed, while in the second slice, two depths of binary tree division may be allowed.
[0123] 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 (Temporal ID) of a slice or picture. Here, a temporal level identifier (Temporal ID) is used to identify each of a plurality of video layers having scalability of at least one of view, space, time, or quality.
[0124] like Figure 3 As shown, the first coding block 300 with a division 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 a width of half that of the first coding block and a height of half that of the first coding block, and the division depth of the second coding block can be increased to k+1.
[0125] The second coding block 310 with a division depth of k+1 may be divided into a plurality of third coding blocks with a division depth of k+2. The division of the second coding block 310 may be performed according to a division method by selectively using one of a quadtree and a binary tree. Here, the division method may be determined according to at least one of information indicating a quadtree-based division and information indicating a binary tree-based division.
[0126] 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 a width of half the second coding block and a height of half 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 a width of half the second coding block and a height of half 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 according to 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 in the horizontal direction.
[0127] At the same time, the second coding block 310 can be determined as a leaf coding block that is no longer divided based on a quadtree or a binary tree. In this case, the leaf coding block can be used as a prediction block or a transform block.
[0128] Similar to the division of the second coding block 310, the third coding block 310a may be determined as a leaf coding block, or may be further divided based on a quadtree or a binary tree.
[0129] At the same time, the third coding block 310b based on the binary tree partition 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 partition 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 partitioned 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 partitioning process can be restrictively performed based on at least one of the following information: information about the size / depth of the coding block that allows quadtree-based partitioning, information about the size / depth of the coding block that allows binary tree-based partitioning, and information about the size / depth of the coding block that does not allow binary tree-based partitioning.
[0130] 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 the picture may be signaled through a sequence header or a picture header.
[0131] As a result of quadtree and binary tree based partitioning, the coding unit may be represented in a square shape or a rectangular shape of an arbitrary size.
[0132] The coding block is encoded using at least one of a skip mode, an intra prediction, an inter prediction, or a skip method. Once the coding block is determined, the prediction block can be determined by predictive partitioning of the coding block. The predictive partitioning of the coding block can be performed by a partitioning mode (Part_mode) indicating the partitioning type of the coding block. The size or shape of the prediction block can be determined according to the partitioning mode of the coding block. For example, the size of the prediction block determined according to the partitioning mode can be equal to or smaller than the size of the coding block.
[0133] Figure 7 is a diagram showing a partitioning mode that can be applied to a coding block when the coding block is encoded by inter prediction.
[0134] As in Figure 4 In the example shown, when a coding block is encoded by inter prediction, one of eight partition modes may be applied to the coding block.
[0135] When the coding block is encoded by intra prediction, a partition mode PART_2N×2N or a partition mode PART_N×N may be applied to the coding block.
[0136] 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. Or 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 through the slice header so that the minimum size of the coding block can be defined for each slice.
[0137] Generally, the size of the predetermined block may be from 64×64 to 4×4. However, when the coding block is encoded by inter-frame prediction, the prediction block may be restricted to not have a size of 4×4 to reduce memory bandwidth when performing motion compensation.
[0138] Figure 8 is a flowchart showing a process of obtaining residual samples according to an embodiment to which the present invention is applied.
[0139] First, the residual coefficient of the current block can be obtained S810. The decoder can obtain the residual coefficient by a coefficient scanning method. For example, the decoder can perform coefficient scanning using zigzag scanning, vertical scanning, or horizontal scanning, and can obtain the residual coefficient in the form of a two-dimensional block.
[0140] Inverse quantization S820 may be performed on the residual coefficients of the current block.
[0141] Inverse transform S830 is selectively performed according to whether to skip inverse transform of the inverse quantized residual coefficients of the current block. Specifically, the decoder can determine whether to skip inverse transform in at least one of the horizontal direction or the vertical direction of the current block. When it is determined to apply inverse transform in at least one of the horizontal direction or the vertical direction of the current block, the residual samples of the current block can be obtained by inverse transforming the inverse quantized residual coefficients of the current block. Here, at least one of DCT, DST and KLT can be used to perform inverse transform.
[0142] When inverse transform in both horizontal and vertical directions of the current block is skipped, inverse transform is not performed in the horizontal and vertical directions of the current block. In this case, the residual samples of the current block can be obtained by scaling the inverse quantized residual coefficients with a predetermined value.
[0143] Skipping the inverse transform in the horizontal direction means that the inverse transform is not performed in the horizontal direction, but the inverse transform is performed in the vertical direction. At this time, scaling can be performed in the horizontal direction.
[0144] Skipping the inverse transform in the vertical direction means that the inverse transform is not performed in the vertical direction, but the inverse transform is performed in the horizontal direction. At this time, scaling can be performed in the vertical direction.
[0145] It can be determined whether the inverse transform skip technique can be used for the current block according to the partition type of the current block. For example, if the current block is generated by binary tree-based partitioning, the inverse transform skip scheme can be limited for the current block. Therefore, when the current block is generated by binary tree-based partitioning, the residual sample 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 the inverse transform (e.g., transform_skip_flag) can be omitted.
[0146] 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-prediction mode of the current block.
[0147] For example, when the current block is a non-square block with a width greater than a height, only the inverse transform skip scheme in the vertical direction may be allowed and the inverse transform skip scheme in the horizontal direction may be restricted. That is, when the current block is 2N×N, the inverse transform is performed in the horizontal direction of the current block, and the inverse transform may be selectively performed in the vertical direction.
[0148] In other words, when the current block is a non-square block with a height greater than a width, only the inverse transform skip scheme in the horizontal direction may be allowed and the inverse transform skip scheme in the vertical direction may be restricted. That is, when the current block is N×2N, the inverse transform is performed in the vertical direction of the current block, and the inverse transform may be selectively performed in the horizontal direction.
[0149] Compared with the above example, when the current block is a non-square block with a width greater than a height, only the inverse transform skip scheme in the horizontal direction may be allowed, and when the current block is a non-square block with a height greater than a width, only the inverse transform skip scheme in the vertical direction may be allowed.
[0150] Information indicating whether to skip the inverse transform in the horizontal direction or information indicating whether to skip the inverse transform in the vertical direction may be notified by a signal through a bitstream. For example, the information indicating whether to skip the inverse transform in the horizontal direction is a 1-bit flag "hor_transform_skip_flag", and the information indicating whether to skip the 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 the inverse transform in the horizontal direction or the inverse transform in the vertical direction by using at least one of "hor_transform_skip_flag" or "ver_transform_skip_flag".
[0151] It can be set according to the partition type of the current block to skip the inverse transform in any direction of the current block. For example, if the current block is generated by binary tree-based partitioning, the inverse transform in the horizontal direction or the inverse transform in the vertical direction can be skipped. That is, if the current block is generated by binary tree-based partitioning, without encoding / decoding information indicating whether to skip the inverse transform of the current block (e.g., transform_skip_flag, hor_transform_skip_flag, ver_transform_skip_flag), it can be determined to skip the inverse transform of the current block in at least one of the horizontal direction or the vertical direction.
[0152] Fig. 9 is a flowchart showing an inter-frame prediction method according to an embodiment to which the present invention is applied.
[0153] Reference Fig. 9 , determine the motion information of the current block S910. The motion information of the current block may include at least one of a motion vector related to the current block, a reference picture index of the current block, or an inter-frame prediction direction of the current block.
[0154] The motion information of the current block may be obtained based on at least one of information signaled through a bitstream or motion information of a neighboring block adjacent to the current block.
[0155] Fig.10 is a diagram showing a process of obtaining motion information of a current block when a merge mode is applied to the current block.
[0156] If the merge mode is applied to the current block, a spatial merge candidate may be obtained from the spatial neighboring blocks of the current block S1010. The spatial neighboring blocks may include at least one of the blocks adjacent to the left, top, or corner (e.g., at least one of the upper left corner, upper right corner, or lower left corner) of the current block.
[0157] The motion information of the spatial merging candidate may be set to be the same as the motion information of the spatial neighboring blocks.
[0158] A temporal merge candidate may be obtained from the temporal neighboring blocks of the current block S1020. A temporal neighboring block may mean a block included in a collocated picture. A collocated picture has a different picture order count (POC) from a current picture including the current block. A collocated picture may be determined as a picture having a predetermined index in a reference picture list, or a collocated picture may be determined by an index signaled from a bitstream. A temporal neighboring block may be determined as a block including coordinates in a collocated block having the same position as the current block in the collocated picture or a block adjacent to the collocated block. For example, at least one of a block including the center coordinates of a collocated block or a block adjacent to the lower left boundary of a collocated block may be determined as a temporal neighboring block.
[0159] The motion information of the temporal merge candidate may be determined based on the motion information of the temporal neighboring blocks. For example, the motion vector of the temporal merge candidate may be determined based on the motion vector of the temporal neighboring blocks. In addition, the inter-frame prediction direction of the temporal merge candidate may be set to be the same as the inter-frame prediction direction of the temporal neighboring blocks. However, the reference picture index of the temporal merge candidate may have a fixed value. For example, the reference picture index of the temporal merge candidate may be set to "0".
[0160] Thereafter, a merge candidate list including the spatial merge candidate and the temporal merge candidate may be generated S1030. If the number of merge candidates included in the merge candidate list is less than the maximum merge candidate number, a combined merge candidate combining two or more merge candidates may be included in the merge candidate list.
[0161] When generating the merge candidate list, at least one of the merge candidates included in the merge candidate list may be specified based on the merge candidate index S1040.
[0162] The motion information of the current block may be set to be the same as the motion information of the merge candidate specified by the merge candidate index S1050. For example, when a spatial merge candidate is selected by the merge candidate index, the motion information of the current block may be set to be the same as the motion information of the spatial neighboring block. Alternatively, when a temporal merge candidate is selected by the merge candidate index, the motion information of the current block may be set to be the same as the motion information of the temporal neighboring block.
[0163] Fig.11 is a diagram showing a process of obtaining motion information of a current block when the AMVP mode is applied to the current block.
[0164] When the AMVP mode is applied to the current block, at least one of the inter prediction direction or the reference picture index of the current block may be decoded according to the bitstream S1110. That is, when the AMVP mode is applied, at least one of the inter prediction direction or the reference picture index of the current block may be determined based on information encoded by the bitstream.
[0165] A spatial motion vector candidate may be determined based on the motion vector of the spatial neighboring block of the current block S1120. The spatial motion vector candidate may include at least one of a first spatial motion vector candidate obtained from a top neighboring block of the current block and a second spatial motion vector candidate obtained from a left neighboring block of the current block. Here, the top neighboring block may include at least one of the blocks adjacent to the top or upper right corner of the current block, and the left neighboring block of the current block may include at least one of the blocks adjacent to the left or lower left corner of the current block. A block adjacent to the upper left corner of the current block may be regarded as a top neighboring block or a left neighboring block.
[0166] When the reference pictures between the current block and the spatially adjacent blocks are different from each other, the spatial motion vector may also be obtained by scaling the motion vector of the spatially adjacent blocks.
[0167] Temporal motion vector candidates may be determined based on motion vectors of temporal neighboring blocks of the current block S1130. When reference pictures between the current block and the temporal neighboring blocks are different from each other, the temporal motion vector may also be obtained by scaling the motion vectors of the temporal neighboring blocks.
[0168] A motion vector candidate list including spatial motion vector candidates and temporal motion vector candidates may be generated S1140.
[0169] When the motion vector candidate list is generated, at least one of the motion vector candidates included in the motion vector candidate list may be specified based on information that specifies at least one from the motion vector candidate list S1150.
[0170] The motion vector candidate specified by the information may be set as a motion vector predictor of the current block, and the motion vector difference value may be added to the motion vector predictor value to obtain the motion vector of the current block S1160. At this time, the motion vector difference value may be parsed through the bitstream.
[0171] When the motion information of the current block is obtained, motion compensation for the current block may be performed based on the obtained motion information S920. More specifically, motion compensation for the current block may be performed based on the inter prediction direction, the reference picture index, and the motion vector of the current block.
[0172] The inter-frame prediction direction may indicate N directions. Here, N is a natural number and may be 1, 2, or 3 or more. If the inter-frame prediction direction indicates N directions, this means that the inter-frame prediction of the current block is performed based on N reference pictures or N reference blocks. For example, when the inter-frame prediction direction of the current block indicates a single direction, the inter-frame prediction of the current block may be performed based on one reference picture. On the other hand, when the inter-frame prediction of the current block indicates a bidirectional direction, two reference pictures or two reference blocks may be used to perform the inter-frame prediction of the current block.
[0173] It is also possible to determine whether multi-directional prediction of the current block is allowed based on at least one of the size or shape of the current block. For example, when the coding unit has a square shape, multi-directional prediction is allowed for encoding / decoding of the coding unit. In other words, when the coding unit has a non-square shape, only single-directional prediction is allowed for encoding / decoding of the coding unit. Contrary to the above, it can also be set that when the coding unit has a non-square shape, multi-directional prediction is allowed for encoding / decoding of the coding unit, and when the coding unit has a square shape, only single-directional prediction is allowed for encoding / decoding of the coding unit. Alternatively, it can also be set that when the prediction unit has a non-square shape such as 4×8 or 8×4, multi-directional prediction is not allowed for encoding / decoding of the prediction unit.
[0174] The reference picture index may specify a reference picture to be used for inter prediction of the current block. Specifically, the reference picture index may specify any one of the reference pictures included in the reference picture list. For example, when the inter prediction direction of the current block is bidirectional, the reference picture (reference picture L0) included in the reference picture list L0 is specified by the reference picture index L0, and the reference picture (reference picture L1) included in the reference picture list L1 is specified by the reference picture index L1.
[0175] Alternatively, one reference picture may be included in two or more reference picture lists. Therefore, even if the reference picture index of the reference picture included in the reference picture list L0 is different from the reference picture index of the reference picture included in the reference picture list L1, the temporal order (picture order count, POC) of the two reference pictures may be the same.
[0176] The motion vector can be used to specify the position of the reference block in the reference picture corresponding to the prediction block of the current block. Inter-frame prediction of the current block can be performed based on the reference block specified by the motion vector in the reference picture. For example, integer pixels included in the reference block or non-integer pixels generated by interpolating integer pixels can be generated as prediction samples of the current block. The following is also possible: reference blocks specified by different motion vectors may be included in the same reference picture. For example, when the reference picture selected from the reference picture list L0 and the reference picture selected from the reference picture list L1 are the same, the reference block specified by the motion vector L0 and the reference block specified by the motion vector L1 may be included in the same reference picture.
[0177] As described above, when the inter prediction direction of the current block indicates two or more directions, motion compensation for the current block may be performed based on two or more reference pictures or two or more reference blocks.
[0178] For example, when the current block is encoded using bidirectional prediction, a prediction block of the current block can be obtained based on two reference blocks obtained from two reference pictures. In addition, when the current block is encoded using bidirectional prediction, a residual block indicating the difference between the original block and the prediction block obtained based on the two reference blocks can be encoded / decoded.
[0179] When two or more reference pictures are used, motion compensation for the current block can be performed by applying the same or different weights to the corresponding reference pictures. Hereinafter, when the inter-frame prediction direction indicates two or more directions, the method for performing weighted prediction on the current block will be described in detail in the following embodiments. For ease of explanation, it is assumed that the inter-frame prediction direction of the current block is bidirectional. However, even when the inter-frame prediction direction of the current block indicates three or more directions, the following embodiments may still be applicable to the present application. In addition, motion compensation for the current block using two predicted images will be referred to as a bidirectional prediction method or a bidirectional prediction encoding / decoding method.
[0180] When bidirectional prediction is applied to the current block, the reference picture used for the bidirectional prediction of the current block may include: a picture before the current picture in time order (picture order count, POC), a picture after the current picture in time order, or the current picture. For example, one of the two reference pictures may be a picture before the current picture in time order, and the other picture may be a picture after the current picture in time order. Alternatively, one of the two reference pictures may be the current picture, and the other picture may be a picture before the current block in time order or a picture after the current picture in time order. Alternatively, both reference pictures may have a time order before the current picture, or may have a time order after the current picture. Alternatively, both reference pictures may be the current picture.
[0181] Two prediction blocks may be generated from each of the two reference picture lists. For example, a prediction block based on reference picture L0 may be generated based on motion vector L0, and a prediction block based on reference picture L1 may be generated based on motion vector L1. The following is also possible: a prediction block generated by motion vector L0 and a prediction block generated by motion vector L1 may be generated based on the same reference picture.
[0182] The prediction block of the current block may be obtained based on an average value of prediction blocks generated from two reference pictures. For example, Equation 1 shows an example of obtaining the prediction block of the current block based on an average value of a plurality of prediction blocks.
[0183] [Equation 1]
[0184] P(x)=1 / 2*P0(x)+1 / 2*P1(x)
[0185] In Equation 1, P(x) refers to the final prediction sample of the current block or the prediction sample of the bidirectional prediction, P N (x) refers to the sample value of the prediction block LN generated based on the reference picture LN. For example, P0(x) may mean the prediction sample of the prediction block generated based on the reference picture L0, and P1(x) may mean the prediction sample of the prediction block generated based on the reference picture L1. That is, according to Equation 1, the final prediction block of the current block can be obtained based on the weighted sum of multiple prediction blocks generated based on multiple reference pictures. At this time, a weight of a fixed value predefined in the encoder / decoder can be assigned to each prediction block.
[0186] According to an embodiment of the present invention, a final prediction block of a current block is obtained based on a weighted sum of a plurality of prediction blocks, and the weight assigned to each prediction block can be variably / adaptively determined. For example, when two reference pictures or two prediction blocks have different brightness, it is more efficient to perform a bidirectional prediction on the current block by applying different weights to each of the prediction blocks than to perform a bidirectional prediction on the current block by averaging the prediction blocks. Hereinafter, for ease of explanation, the bidirectional prediction method will be referred to as "bidirectional weighted prediction" when the weight assigned to each of the prediction blocks is variably / adaptively determined.
[0187] It can also be determined based on at least one of the size or shape of the current block: whether bidirectional weighted prediction is allowed for the current block. For example, if the coding unit has a square shape, encoding / decoding of the coding unit using bidirectional weighted prediction is allowed, and if the coding unit has a non-square shape, encoding / decoding of the coding unit using bidirectional weighted prediction is not allowed. In contrast to the above, it can also be set that when the coding block has a non-square shape, encoding / decoding of the coding block using bidirectional weighted prediction is allowed, and when the coding block has a square shape, encoding / decoding of the coding block using bidirectional weighted prediction is not allowed. Alternatively, it can also be set that when the prediction unit is a non-square partition with a size of 4×8 or 8×4, etc., bidirectional weighted prediction is not allowed for encoding / decoding of the prediction unit.
[0188] Fig.12 4 is a flowchart of a bidirectional weighted prediction method according to an embodiment of the present invention.
[0189] To perform bidirectional weighted prediction, weighted prediction parameters for the current block may be determined S1210. The weighted prediction parameters may be used to determine the weights to be applied to the two reference pictures. Fig.13As depicted in FIG, weights 1-w may be applied to a prediction block generated based on reference picture L0, and weight w may be applied to a prediction block generated based on reference picture L1. Based on the weighted prediction parameter, a weight to be applied to each prediction block is determined S1220, and a weighted sum operation of a plurality of prediction blocks is performed based on the determined weight to generate a final prediction block of the current block S1230. For example, the final prediction block of the current block may be generated based on the following equation 2.
[0190] [Equation 2]
[0191] P(x)=(1-w)*P0(x)+w*P1(x)
[0192] In Equation 2, w represents the weighted prediction parameter.
[0193] As shown in Equation 2, the final prediction block P(x) of the current block can be obtained by assigning a weight 1-w to the prediction block P0 and a weight w to the prediction block P1. Contrary to what is shown in Equation 2, a weight w can also be assigned to the prediction block P0 and a weight 1-w to the prediction block P1.
[0194] The weighted prediction parameters may be determined based on the difference in brightness between the reference pictures, or may be determined based on the distance between the current picture and the reference picture (ie, POC difference). Alternatively, the weighted prediction parameters may also be determined based on the size or shape of the current block.
[0195] The weighted prediction parameter may be determined in units of blocks (eg, coding tree units, coding units, prediction units, or transform units), or may be determined in units of slices or pictures.
[0196] At this time, the weighted prediction parameter can be determined based on the predetermined candidate weighted prediction parameter. As an example, the weighted prediction parameter can be determined as one of the predetermined values such as -1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4 or 5 / 4.
[0197] Alternatively, after determining the weighted prediction parameter set for the current block, a weighted prediction parameter may be further determined from at least one of the candidate weighted prediction parameters included in the determined weighted prediction parameter set. The weighted prediction parameter set may be determined in units of blocks (e.g., coding tree units, coding units, prediction units, or transform units), or may be determined in units of slices or pictures.
[0198] For example, if one of the weighted prediction parameter sets w0 and w1 is selected, at least one of the candidate weighted prediction parameters included in the selected weighted prediction parameter set may be determined as the weighted prediction parameter for the current block. For example, assuming that the weighted prediction parameter set is: w0 = {-1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4, 5 / 4}, w1 = {-3 / 8, -1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4}. When the weighted prediction parameter set w0 is selected, the weighted prediction parameter w of the current block may be determined as one of the candidate weighted prediction parameters -1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4 and 5 / 4 included in w0.
[0199] The weighted prediction parameter set that can be used for the current block can be determined according to the temporal order or temporal direction of the reference pictures used for bidirectional prediction. The temporal order can indicate the encoding / decoding order between pictures, or can indicate the output order of pictures (e.g., POC). In addition, the temporal direction can indicate whether the temporal order of the reference picture is before or after the current picture.
[0200] As an example, a weighted prediction parameter set that can be used for the current picture can be determined according to whether two reference pictures used for bidirectional prediction have the same temporal order. For example, a weighted prediction parameter set that can be used for the current block can be variably determined according to whether the reference picture L0 and the reference picture L1 are the same picture (that is, the temporal order of the pictures is the same) or whether the reference picture L0 and the reference picture L1 are different from each other (that is, the temporal order of the pictures is different).
[0201] Different weighted prediction parameter sets may mean that at least one of the absolute value, sign or quantity of the weighted prediction parameter included in each weighted prediction parameter set is different. For example, when the time directions of reference picture L0 and reference picture L1 are the same, the weighted prediction parameter set w0={-1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4, 5 / 4} can be used, and when the time directions of reference picture L0 and reference picture L1 are different, the weighted prediction parameter set w1={-3 / 8, -1 / 4, 1 / 4, 3 / 8, 1 / 2, 5 / 8, 3 / 4} can be used.
[0202] As an example, a weighted prediction parameter set that can be used for a current picture can be determined based on whether the time directions of two reference pictures used in bidirectional prediction are the same. For example, a weighted prediction parameter set that can be used for a current block can be determined differently between when the time directions of the two reference pictures are the same and when the time directions of the two reference pictures are different. Specifically, the weighted prediction parameters of the current block can be determined differently based on whether reference picture L0 and reference picture L1 are both before the current picture, whether reference picture L0 and reference picture L1 are both after the current picture, or whether the time directions of reference picture L0 and reference picture L1 are different.
[0203] The number of available candidate weighted prediction parameters or the number of available weighted prediction parameter sets may be set differently for each block, each slice, or each picture. For example, the number of available candidate weighted prediction parameters or the number of available weighted prediction parameter sets may be signaled per slice. Therefore, the number of available candidate weighted prediction parameters or the number of available weighted prediction parameter sets may be different for each slice.
[0204] The weighted prediction parameter may be obtained from a neighboring block adjacent to the current block. Here, the neighboring block adjacent to the current block may include at least one of a spatial neighboring block or a temporal neighboring block of the current block.
[0205] As an example, the weighted prediction parameter of the current block may be set to a minimum value or a maximum value among weighted prediction parameters of neighboring blocks adjacent to the current block, or may be set to an average value of weighted prediction parameters of neighboring blocks.
[0206] As an example, the weighted prediction parameters of the current block can be obtained from the neighboring blocks located at a predetermined position in the neighboring blocks adjacent to the current block. Here, the predetermined position can be determined variably or fixedly. Specifically, the position of the neighboring block is determined by the size of the current block (e.g., coding unit, prediction unit, or transform unit), the position of the current block in the coding tree unit, the shape of the current block (e.g., the partition type of the current block), or the partition index of the current block. Alternatively, the position of the neighboring block can be predefined and fixedly determined in the encoder / decoder.
[0207] As an example, the weighted prediction parameters of the current block can be obtained from the neighboring blocks to which the bidirectional weighted prediction is applied among the neighboring blocks adjacent to the current block. Specifically, when the neighboring blocks adjacent to the current block are scanned in a predetermined order, the weighted prediction parameters of the current block can be obtained from the weighted prediction parameters of the first detected neighboring block to which the bidirectional weighted prediction is applied. Fig.14 is a diagram showing the scanning order between adjacent blocks. Fig.14In the example shown in FIG. 1 , the scanning is performed in the order of the left neighboring block, the upper neighboring block, the upper right neighboring block, the lower left neighboring block, and the upper left neighboring block, but the present invention is not limited to the illustrated example. When the scanning is performed in the following predetermined order, the weighted prediction parameters of the first detected neighboring blocks to which the bidirectional weighted prediction is applied can be used as the weighted prediction parameters of the current block.
[0208] Alternatively, when the scan is performed in the following predetermined order, the weighted prediction parameter of the first detected neighboring block to which the bidirectional weighted prediction is applied may also be set as the weighted prediction parameter prediction value of the current block. In this case, the weighted prediction parameter of the current block may be obtained by using the weighted prediction parameter prediction value and the weighted prediction parameter residual value.
[0209] As an example, the weighted prediction parameter of the current block may also be obtained from a spatial neighboring block or a temporal neighboring block merged with the motion information of the current block or from a spatial neighboring block or a temporal neighboring block used to obtain a motion vector prediction value of the current block.
[0210] Information for determining the weighted prediction parameter may also be signaled via the bitstream. For example, the weighted prediction parameter of the current block may be determined based on at least one of information indicating a value of the weighted prediction parameter, index information specifying one of the candidate weighted prediction parameters, or set index information specifying one of the weighted prediction parameter sets.
[0211] When binarizing and encoding the weighted prediction parameters, the minimum binary codeword can be mapped to the weighted prediction parameter with the highest usage frequency statistically. For example, as shown in Table 1 below, truncated unary binarization can be performed on the weighted prediction parameters. Table 1 is an example in the case where cMax is 6.
[0212] [Table 1]
[0213] index Weighted prediction parameters Binary codeword 0 -1 / 4 111111 1 1 / 4 11110 2 3 / 8 110 3 1 / 2 0 4 5 / 8 10 5 3 / 4 1110 6 5 / 4 111110
[0214] The truncated unary binarization method shown in Table 1 is substantially the same as the unary binarization method except that the conversion is performed after receiving the maximum value (cMax) of the input in advance. Table 2 shows the truncated unary binarization in the case where cMax is 13.
[0215] [Table 2]
[0216] value Binarization 0 0 1 1 0 2 1 1 0 3 1 1 1 0 ... 12 1 1 1 1 1 1 1 1 1 1 1 1 0 13 1 1 1 1 1 1 1 1 1 1 1 1 1
[0217] During the binarization of the weighted prediction parameters, different binary codewords may be used depending on whether the temporal directions of the reference pictures used for bidirectional prediction are the same. For example, Table 3 shows the binary codewords depending on whether the temporal directions of the reference pictures L0 and L1 are the same.
[0218] [Table 3]
[0219]
[0220]
[0221] The weighted prediction parameters of the current block may also be determined based on the temporal order difference between the current picture and the reference picture. Here, the temporal order difference may indicate the encoding / decoding order difference between the pictures or the output order difference between the pictures (e.g., POC difference). For example, the weighted prediction parameters of the current picture may be determined based on at least one of the POC difference between the current picture and the reference picture L0 (hereinafter referred to as the first reference distance) and the POC difference between the current picture and the reference picture L1 (hereinafter referred to as the second reference distance).
[0222] Specifically, the weighted prediction parameter of the current block may be determined based on the ratio between the first reference distance and the second reference distance. When the first reference distance is w and the second reference distance is h, w / (w+h) may be used as the weighted prediction parameter of the current block. For example, when the first reference distance and the second reference distance are the same, the weighted prediction parameter of the current block may be determined to be 1 / 2. In addition, when the first reference distance is 1 and the second reference distance is 3, the weighted prediction parameter of the current block may be determined to be 1 / 4.
[0223] Alternatively, when the first reference distance is w and the second reference distance is h, a candidate weighted prediction parameter having a value most similar to w / (w+h) among the candidate weighted prediction parameters may also be used as the weighted prediction parameter of the current block.
[0224] Alternatively, the weighted prediction parameter of the current block may also be binarized in consideration of the first reference distance and the second reference distance. Table 4 shows binary codewords based on the first reference distance and the second reference distance.
[0225] [Table 4]
[0226]
[0227]
[0228] In the example shown in Table 4, when the first reference distance is the same as the second reference distance, the probability of setting the weighted prediction parameter to 1 / 2 is high. Therefore, when the first reference distance is the same as the second reference distance, 1 / 2 may be allocated to the minimum codeword.
[0229] When the first reference distance is different from the second reference distance, the minimum binary codeword can be mapped to the statistically most frequently used weighted prediction parameter. For example, when the first reference distance is greater than the second reference distance, the probability of assigning a greater weight to the reference image L1 is high. Therefore, the minimum binary codeword can be mapped to a weighted prediction parameter greater than 1 / 2. In other words, when the first reference distance is less than the second reference distance, the probability of assigning a greater weight to the reference image L0 is high. Therefore, the minimum binary codeword can be mapped to a weighted prediction parameter less than 1 / 2.
[0230] In contrast to the example shown in Table 4, the minimum binary codeword may also be mapped to a weighted prediction parameter less than 1 / 2 when the first reference distance is greater than the second reference distance, and the minimum binary codeword may be mapped to a weighted prediction parameter greater than 1 / 2 when the first reference distance is less than the second reference distance.
[0231] It is also possible to perform prediction on the current block by combining two or more prediction modes. The combined prediction mode may be a combination of an inter prediction mode and an intra prediction mode or a combination of two or more inter prediction methods. Here, the inter prediction method may include at least one of a skip mode, a merge mode, an AMVP mode, or a current picture reference mode. The current picture reference mode represents an inter prediction method using a current picture including the current block as a reference picture. When the current picture reference mode is used, the prediction block of the current block can be obtained from an area reconstructed before the current block. The current picture reference mode can also be classified as one of the intra prediction modes instead of the inter prediction mode. Alternatively, the current picture reference mode can be understood as an implementation of a skip mode, a merge mode, or an AMVP mode. Alternatively, a combined prediction mode can also be constructed using two or more intra prediction modes (e.g., a directional prediction mode and a non-directional prediction mode or two or more directional prediction modes, etc.).
[0232] Hereinafter, a method of performing prediction on a current block by combining two or more prediction modes will be described in detail.
[0233] Fig.15 is a flow chart showing a combined prediction method according to the present invention.
[0234] First, based on the first prediction mode, a first prediction block for the current block may be generated S1510. Then, based on the second prediction mode, a second prediction block for the current block may be generated S1520. The first prediction mode and the second prediction mode may be different prediction modes. Either the first prediction block or the second prediction block may be generated by multi-directional prediction.
[0235] The weighted prediction parameters for the current block may be determined S1530. Fig.12 The implementation for determining the weighted prediction parameters has been described in detail, so a detailed description thereof will be omitted in this embodiment.
[0236] The weights to be applied to the first prediction block and the second prediction block are determined based on the weighted prediction parameters S1540, and a final prediction block of the current block is generated by performing a weighted sum operation of the plurality of prediction blocks based on the determined weights S1550.
[0237] Fig.16 and Fig.17 is a diagram showing an example of generating a prediction block of a current block based on a weighted sum of a plurality of prediction blocks obtained through different prediction modes.
[0238] Reference Fig.16 , the prediction block P0 (inter-frame prediction) can be generated based on the reference picture L0 or the reference picture L1, and the prediction block P1 (intra-frame prediction) can be generated based on the adjacent samples encoded / decoded before the current block. In this case, the prediction block of the current block can be generated based on the weighted sum operation of the prediction block P0 and the prediction block P1.
[0239] Reference Fig.17 , the prediction block P0 may be generated based on the reference picture L0 or the reference picture L1, and the prediction block P1 may be generated based on the current picture in the current picture reference mode. In this case, the prediction block of the current block may be generated based on the weighted sum operation of the prediction block P0 and the prediction block P1.
[0240] Whether to use a combined prediction method that combines two or more prediction modes may be determined based on information signaled by the bitstream. For example, information indicating at least one of an intra prediction mode, an inter prediction mode, or a combined prediction mode may be signaled by the bitstream. Use of the combined prediction mode may also be limited based on the size or shape of the block. For example, use of the combined prediction mode may be limited if the size of the current block is equal to or less than 8×8 or if the current block has a non-square shape.
[0241] The prediction mode of the current block may be determined in units of sub-blocks. For example, when the current block is divided into N partitions, a prediction mode may be determined separately for each of the N partitions. The partition type of the current block may be symmetrical or asymmetrical. Therefore, the sub-block may have a square shape or a non-square shape. Whether to use a single prediction mode or a combined prediction mode may be determined in units of sub-blocks.
[0242] At this time, the prediction mode for each sub-block can be determined in consideration of the distance from the reference sample. For example, when the current block is encoded using the intra prediction mode, as the distance from the reference sample increases, the correlation with the reference sample becomes smaller. Therefore, it can be considered that the correlation between the sample far from the reference sample in the current block (for example, the sample included in the right column or the lower row of the current block) and the reference sample is small. Therefore, the sub-block adjacent to the reference sample (for example, the top reference sample or the left reference sample) can be encoded / decoded by intra prediction, and the sub-block far from the reference sample can be encoded / decoded by a combined prediction method that combines intra prediction and inter prediction.
[0243] As in Fig.18 In the example shown, the prediction block of subblock 0 can be generated based on the intra prediction mode. In other words, the prediction block of subblock 1 can be generated based on the weighted sum operation of the first prediction block and the second prediction block, the first prediction block is generated based on the intra prediction mode, and the second prediction block is generated by the inter prediction mode.
[0244] Although the current block is similar to the reference block in the reference picture, if there is a change in brightness between the current picture and the previous picture, the efficiency of intra prediction or inter prediction may be reduced. Therefore, illumination compensation may be considered for the change in brightness between the current picture and the reference picture to compensate for the prediction sample generated by intra prediction or inter prediction or the reconstructed sample reconstructed based on the prediction sample. Illumination compensation may be performed by applying illumination compensation weights and offsets to an image encoded / decoded in intra prediction or inter prediction. For example, illumination compensation prediction may be performed based on the following equation 3.
[0245] [Equation 3]
[0246] p′=l×p+f
[0247] In Equation 3, p may refer to a prediction sample encoded / decoded by intra prediction or inter prediction. l refers to an illumination compensation weight, and f refers to an offset. p′ may refer to a weighted prediction sample to which illumination compensation is applied.
[0248] Illumination compensation may also be applied to a reconstructed sample obtained based on a prediction sample encoded / decoded in intra prediction or inter prediction. Specifically, illumination compensation may be applied to the reconstructed sample before applying the in-loop filter, or illumination compensation may be applied to the reconstructed sample after applying the in-loop filter. In this case, in Equation 3, p may refer to the reconstructed sample, and p′ may refer to the weighted reconstructed sample to which illumination compensation is applied.
[0249] When comparing a current picture or a current slice with a previous picture or a previous slice, illumination changes may occur across the entire region of the current picture or the current slice. Therefore, illumination compensation may be performed in units of sequences, pictures, or slices.
[0250] Alternatively, when comparing the current slice or the current sequence with the previous slice or the previous sequence, the illumination change may occur only in a partial area within the slice or the sequence. Therefore, illumination compensation may be performed in units of predetermined areas in the picture or slice. That is, by determining whether to perform illumination compensation in units of predetermined areas, illumination compensation may be performed only on a partial area in the picture or slice where the illumination change occurs.
[0251] When illumination compensation is performed only on a predetermined area within a picture or a slice, information for determining the area where illumination compensation is performed may be encoded / decoded. For example, information indicating the position of the area where illumination compensation is performed, the size of the area where illumination compensation is performed, or the shape of the area where illumination compensation is performed may be encoded / decoded.
[0252] Alternatively, information indicating whether illumination compensation is to be performed in units of blocks may also be encoded / decoded. The information may be a 1-bit flag, but is not limited thereto. For example, whether illumination compensation is to be performed may be determined in units of coding tree units, coding units, prediction units, or transform units. Therefore, information indicating whether illumination compensation is to be performed may be determined in units of coding tree units, coding units, prediction units, or transform units.
[0253] It is also possible to determine an area in a picture or a slice where illumination compensation is performed, and then determine whether illumination compensation is to be performed on each block included in the area. For example, when the predetermined area includes a plurality of coding tree units, a plurality of coding units, a plurality of prediction units, or a plurality of transform units, information indicating whether illumination compensation is to be performed on each block included in the predetermined area may be signaled. Therefore, illumination compensation may be selectively performed on each block included in the unit where illumination compensation is to be performed.
[0254] Based on the above description, the illumination compensation prediction method according to the present invention will be described in detail.
[0255] Fig.19 is a flow chart of a method for illumination compensation prediction according to the present invention.
[0256] First, an illumination compensation parameter for a current block may be determined S1910. The illumination compensation parameter may include at least one of an illumination compensation weight or an offset.
[0257] The illumination compensation parameters may be signaled through a bitstream in units of a sequence, a picture, a slice, or a coding / decoding block. Here, the unit of the coding / decoding block may represent at least one of a coding tree unit, a coding unit, a prediction unit, or a transform unit.
[0258] Alternatively, the illumination compensation parameters for each predetermined area for performing illumination compensation may also be notified by signal. For example, the illumination compensation parameters for a predetermined area including a plurality of blocks may be notified by signal. The plurality of blocks included in the predetermined area may use the same illumination compensation parameters.
[0259] Regardless of the coding mode of the current block, the illumination compensation parameters may be signaled. Alternatively, it may be determined whether to signal the illumination compensation parameters according to the coding mode of the current block. For example, the illumination compensation parameters may be signaled only when the coding mode of the current block has a predefined mode. Here, the coding mode may indicate whether the current block is encoded by intra-frame prediction (i.e., intra-frame prediction mode) or by inter-frame prediction (i.e., inter-frame prediction mode). For example, the illumination compensation parameters may be signaled only when the current block is encoded using inter-frame prediction. Alternatively, the following is also possible: the coding mode may indicate one of the skip mode, merge mode, AMVP mode, or current picture reference mode as the inter-frame prediction method of the current block.
[0260] As an example, when the current block is encoded using the skip mode or the current picture reference mode, the illumination compensation parameters may not be signaled. In other words, when the current block is encoded using the merge mode or the AMVP mode, the illumination compensation parameters may be signaled through the bitstream. If the illumination compensation parameters are not signaled, illumination compensation for the current block may not be performed. Alternatively, if the illumination compensation parameters are not signaled, illumination compensation for the current block may be performed using illumination compensation parameters predefined in the encoder / decoder.
[0261] The illumination compensation parameter may be obtained based on the illumination change between the first template area in the current picture and the second template area in the reference picture. The first template area may be adjacent to the current block, and the second template area may be adjacent to the reference block. Here, the reference block is used to generate a prediction block of the current block, and the reference block may be specified by a motion vector of the current block. Alternatively, the second template area may have a position in the reference picture co-located with the first template area. The position of the second template area may be variably determined according to the coding mode of the reference picture or the current block.
[0262] When unavailable samples are included in the second template area, replacement values can be assigned to the unavailable samples using available samples. For example, available samples can be copied to the position of unavailable samples, or interpolation values calculated using multiple available samples can be assigned to the position of unavailable samples. Available samples can be included in the second template area or can be located outside the second template area. For example, replacement values of unavailable samples included in the second template area can be calculated based on available samples included in the reference block. At least one of the filter coefficients, shapes, or number of filter taps of the filter used in the interpolation can be variably determined based on at least one of the size or shape of the template area.
[0263] The illumination compensation parameter may be calculated based on the difference between the sample included in the first template area and the sample included in the second template area. For example, when the neighboring samples of the current block are assumed to be yi (i is 0 to N-1) and the neighboring samples of the reference block are assumed to be xi (i is 0 to N-1), the illumination compensation weight l and the offset f may be obtained by calculating the minimum value of E(w, f) in Equation 4.
[0264] [Equation 4]
[0265] E(w,f)=∑ i (p i -(lp i -f)) 2 +λ(w-1) 2
[0266] Equation 4 can be modified into the following Equation 5.
[0267] [Equation 5]
[0268]
[0269] According to Equation 5, Equation 6 for obtaining the illumination compensation weight l and Equation 7 for obtaining the offset f can be obtained.
[0270] [Equation 6]
[0271]
[0272] [Equation 7]
[0273] f=∑iy i -a*∑ i x i
[0274] If the illumination compensation parameters are determined, illumination compensation for the current block may be performed using the determined illumination compensation parameters S1920. Illumination compensation may be performed by applying illumination compensation weights and offsets to a block (eg, a predicted block or a reconstructed block) encoded / decoded in intra prediction or inter prediction.
[0275] When the inter-frame prediction direction of the current block indicates multiple directions, compensation may be performed on at least one prediction block among the multiple prediction blocks, and multi-directional prediction may be performed on the current block based on the prediction block to which illumination compensation is applied. For example, if bidirectional weighted prediction is applied to the current block, illumination compensation may be performed on at least one of the first prediction block and the second prediction block, and then a final prediction block or a bidirectional prediction block of the current block may be generated based on a weighted sum operation between the first prediction block and the second prediction block.
[0276] Fig. 20 It is a flow chart of a bidirectional weighted prediction method based on illumination compensation.
[0277] Reference Fig. 20 First, it may be determined whether illumination compensation is performed on a reference picture S2010. Whether illumination compensation is performed on a reference picture may be determined based on information signaled through a bitstream. The information may be a 1-bit flag, but is not limited thereto. For example, pred_ic_comp_flag may indicate whether illumination compensation is performed on a reference picture.
[0278] If it is determined that illumination compensation is to be performed on the reference block, a reference picture on which illumination compensation is to be performed may be determined S2020. Specifically, when it is determined that illumination compensation is to be performed on the reference block, it may be determined whether illumination compensation is to be performed on reference picture L0 or on reference picture L1. The determination may be performed based on information signaled through a bitstream. The information may specify any one of the reference pictures. Alternatively, the information may be a plurality of 1-bit flags indicating whether illumination compensation is to be performed on each reference picture. For example, at least one of pred_ic_comp_l0_enalbed_flag indicating whether illumination compensation is to be performed on reference picture L0 or pred_ic_comp_l1_enalged_flag indicating whether illumination compensation is to be performed on reference picture L1 may be signaled through a bitstream.
[0279] If the reference picture for which illumination compensation is to be performed is determined, illumination compensation parameters to be applied to the reference picture may be determined S2030. Fig.19 The determination of the illumination compensation parameter has been described in detail, so a detailed description thereof will be omitted in this embodiment.
[0280] Based on the determined illumination compensation parameters, illumination compensation may be performed on a prediction block generated based on a reference picture for which illumination compensation is to be performed S2040. Then, bidirectional weighted prediction may be performed on the current block using the illumination compensated prediction block S2050.
[0281] Fig.21 is a diagram showing an example of performing bidirectional weighted prediction using a prediction block to which illumination compensation is applied. Fig.21 , it is shown that illumination compensation has been performed on the prediction block generated based on the reference picture L1. Therefore, bidirectional weighted prediction of the current block can be performed based on the weighted sum of the prediction block P0 generated based on the reference picture L0 and the illumination compensation prediction block (1*P1+f) generated based on the reference picture L1.
[0282] It is also possible to perform bidirectional weighted prediction on the current block based on the illumination compensation weight for illumination compensation.
[0283] As an example, based on the illumination compensation weight, a weighted prediction parameter of the current block can be obtained to perform bidirectional weighted prediction on the current block. At this time, the weighted prediction parameter w of the current block can be set to the same value as the illumination compensation weight l, or can be set to (1-l). For example, when illumination compensation based on the illumination compensation weight l is applied to a prediction block generated based on the reference picture L0, the bidirectional weighted prediction of the current block can be calculated based on the following equation 8.
[0284] [Equation 8]
[0285] P(x)=l×P0(x)+f+(1-l)*P1(x)
[0286] As an example, bidirectional weighted prediction of the current block may also be performed by applying a weight determined by a weighted prediction parameter to one of the plurality of prediction blocks and applying an illumination compensation weight to the other prediction blocks in the plurality of prediction blocks. For example, the bidirectional weighted prediction of the current block may be calculated based on the following equation 9.
[0287] [Equation 9]
[0288] P(x)=l×P0(x)+f+w*P1(x)
[0289] Although the above-mentioned embodiments have been described based on a series of steps or flow charts, they do not limit the time series order of the present invention, and can be performed simultaneously or in different orders as required. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-mentioned embodiments can be realized by hardware devices or software and multiple components. Or multiple components can be combined and realized by a single hardware device or software. The above-mentioned embodiments can be realized in the form of program instructions, which can be executed by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium can include one or a combination of program commands, data files, data structures, etc., in a program command, a data file, a data structure, etc. The example of a computer-readable medium includes magnetic media (such as hard disk, floppy disk and tape), optical recording media (such as CD-ROM and DVD), magneto-optical media (such as optical magnetic floppy disk), 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.
[0290] Industrial Applicability
[0291] The present invention can be applied to electronic devices capable of encoding / decoding videos.
[0292] In addition, the embodiment of the present invention further includes:
[0293] (1) A method for decoding a video, the method comprising:
[0294] generating a first prediction block of the current block based on the first prediction mode;
[0295] generating a second prediction block of the current block based on the second prediction mode; and
[0296] A final prediction block of the current block is generated based on the first prediction block and the second prediction block.
[0297] (2) The method according to (1), wherein the first prediction mode is different from the second prediction mode.
[0298] (3) The method according to (2), wherein the first prediction mode is an intra-frame prediction mode and the second prediction mode is an inter-frame prediction mode.
[0299] (4). The method according to (1), wherein the first prediction mode is an inter-frame prediction mode different from the second prediction mode, and the inter-frame prediction mode includes at least one of a skip mode, a merge mode, an AMVP (Advanced Motion Vector Prediction) mode, or a current picture reference mode.
[0300] (5) The method according to (1), wherein the final prediction block is obtained based on a weighted sum operation between the first prediction block and the second prediction block.
[0301] (6) The method according to (5), wherein weights applied to the first prediction block and the second prediction block are determined based on a weighted prediction parameter of the current block.
[0302] (7) The method according to (1), wherein whether to use a prediction method combining the first prediction mode and the second prediction mode is determined based on a shape or a size of the current block.
[0303] (8) The method according to (1), wherein the current block includes a first sub-block and a second sub-block, and
[0304] The final prediction block of the first sub-block is generated based on the first prediction block, and the final prediction block of the second sub-block is generated based on the first prediction block and the second prediction block.
[0305] (9) A method for encoding a video, the method comprising:
[0306] generating a first prediction block of the current block based on the first prediction mode;
[0307] generating a second prediction block of the current block based on the second prediction mode; and
[0308] A final prediction block of the current block is generated based on the first prediction block and the second prediction block.
[0309] (10) The method according to (9), wherein the first prediction mode is different from the second prediction mode.
[0310] (11) The method according to (10), wherein the first prediction mode is an intra-frame prediction mode and the second prediction mode is an inter-frame prediction mode.
[0311] (12). The method according to (9), wherein the first prediction mode is an inter-frame prediction mode different from the second prediction mode, and the inter-frame prediction mode includes at least one of a skip mode, a merge mode, an AMVP (Advanced Motion Vector Prediction) mode, or a current picture reference mode.
[0312] (13) The method according to (9), wherein the current block includes a first sub-block and a second sub-block, and
[0313] The final prediction block of the first sub-block is generated based on the first prediction block, and the final prediction block of the second sub-block is generated based on the first prediction block and the second prediction block.
[0314] (14) A device for decoding a video, the device comprising:
[0315] A prediction unit generates a first prediction block of a current block based on a first prediction mode, generates a second prediction block of the current block based on a second prediction mode, and generates a final prediction block of the current block based on the first prediction block and the second prediction block.
[0316] (15) A device for encoding a video, the device comprising:
[0317] A prediction unit generates a first prediction block of a current block based on a first prediction mode, generates a second prediction block of the current block based on a second prediction mode, and generates a final prediction block of the current block based on the first prediction block and the second prediction block.
Claims
1. A method for decoding a video, the method comprising: generating an initial prediction block of the current block by using a reference block corresponding to the current block in the video; as well as The prediction block of the current block is obtained by multiplying the initial prediction block by a weight and then adding an offset, wherein the weight and the offset are derived using a first template region adjacent to the current block and a second template region adjacent to the reference block, and When a reference sample adjacent to the reference block is unavailable, the reference sample is replaced by a sample in the reference block instead of a sample in the second template area.
2. A method for encoding a video, the method comprising: generating an initial prediction block of the current block by using a reference block corresponding to the current block in the video; as well as The prediction block of the current block is obtained by multiplying the initial prediction block by a weight and then adding an offset, wherein the weight and the offset are derived using a first template region adjacent to the current block and a second template region adjacent to the reference block, and When a reference sample adjacent to the reference block is unavailable, the reference sample is replaced by a sample in the reference block instead of a sample in the second template area.
3. A device for sending compressed video data, the device comprising: One or more hardware, the one or more hardware being configured to: Obtaining the compressed video data; as well as sending the compressed video data, Wherein, obtaining the compressed video data comprises: generating an initial prediction block of the current block by using a reference block corresponding to the current block in the video; and The prediction block of the current block is obtained by multiplying the initial prediction block by a weight and then adding an offset, wherein the weight and the offset are derived using a first template region adjacent to the current block and a second template region adjacent to the reference block, and When a reference sample adjacent to the reference block is unavailable, the reference sample is replaced by a sample in the reference block instead of a sample in the second template area.
Citation Information
Patent Citations
Method, apparatus and system for encoding and decoding video data
CN105532000A
Processing illumination compensation for video coding
US20150023422A1