Image decoding method, image encoding method and device including bit stream
Through intra prediction and offset correction technology, video signals are encoded and decoded, which solves the problem of large amount of data of high-resolution video signals, improves encoding efficiency and prediction accuracy, and reduces transmission and storage costs.
Patent Information
- Application Number
- CN202210372899.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2015-09-14
- Filing Date
- 2016-09-12
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2036-09-12
AI Technical Summary
The large amount of high-resolution and high-quality video signal data leads to an increase in transmission and storage costs, and it is difficult for existing image compression technologies to effectively process stereoscopic image content.
By intra prediction of the video signal, a first prediction sample is generated, and the offset in the sub-block unit is determined based on the intra prediction method, a second prediction sample is generated, so as to realize the classification of the coded block and the intra prediction mode. Adapt to adjustment.
Improves encoding efficiency and intra prediction accuracy, reduces data volume, and thus reduces transmission and storage costs.
Smart Images

Figure CN114567785B_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese patent application with the application date of September 12, 2016, the international application number of PCT / KR2016 / 010278, the invention name of “Method and device for processing video signals”, and the application number of 201680065475.6 that has entered the Chinese national phase. Technical Field
[0002] The 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 (e.g., high-definition (HD) images and ultra-high-definition (UHD) images) has increased in various application fields. However, the data amount of image data with higher resolution and quality increases compared to conventional image data. Therefore, when the image data is transmitted by using a medium (e.g., conventional wired and wireless broadband networks), or when the image data is stored by using a conventional storage medium, the transmission cost and the storage cost increase. 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] The image compression technology includes various technologies, including: an inter-frame prediction technology that predicts a pixel value included in a current picture based on a previous picture or a subsequent picture of the current picture; an intra-frame prediction technology that predicts a pixel value included in the current picture by using pixel information in the current picture; an entropy coding technology that assigns a short code to a value with a high frequency of occurrence and a long code to a value with a low frequency of occurrence, etc. Image data can be effectively compressed by using such an image compression technology, and 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 explored. Summary of the invention
[0006] Technical issues
[0007] An object of the present invention is to provide a method and apparatus for encoding / decoding a video signal, wherein the method and apparatus hierarchically divide a coding block.
[0008] An object of the present invention is to provide a method and apparatus for encoding / decoding a video signal, the method and apparatus performing intra-frame prediction on an encoding / decoding target block.
[0009] An object of the present invention is to provide a method and apparatus for encoding / decoding a video signal, wherein the method and apparatus correct a prediction sample of an encoding / decoding target block.
[0010] An object of the present invention is to provide a method and apparatus for encoding / decoding a video signal, the method and apparatus updating a first prediction sample generated by intra prediction to a second prediction sample by using an offset.
[0011] Technical Solution
[0012] According to the present invention, a method and apparatus for decoding a video signal are provided, the method comprising: generating a first prediction sample by performing intra-frame prediction on a current block; determining an intra-frame prediction mode that specifies the way in which the current block is divided into sub-blocks; determining an offset in a sub-block unit of the current block based on the intra-frame prediction mode; and generating a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0013] In the method and apparatus for decoding a video signal according to the present invention, a current block may include a plurality of sub-blocks, and it may be determined whether to set an offset for each sub-block.
[0014] In the method and apparatus for decoding a video signal according to the present invention, whether to set an offset for a sub-block may be determined based on the position of the sub-block.
[0015] In the method and apparatus for decoding a video signal according to the present invention, the current block may include a plurality of sub-blocks, and the offset may be set to a different value for each sub-block.
[0016] In the method and apparatus for decoding a video signal according to the present invention, an offset may be obtained according to reference samples adjacent to a current block.
[0017] According to the present invention, a method and apparatus for encoding a video signal are provided, the method comprising: generating a first prediction sample by performing intra-frame prediction on a current block; determining an intra-frame prediction mode that specifies the way in which the current block is divided into sub-blocks; determining an offset in a sub-block unit of the current block based on the intra-frame prediction mode; and generating a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0018] In the method and apparatus for encoding a video signal according to the present invention, a current block may include a plurality of sub-blocks, and it may be determined whether to set an offset for each sub-block.
[0019] In the method and apparatus for encoding a video signal according to the present invention, whether to set an offset for a sub-block may be determined based on the position of the sub-block.
[0020] In the method and apparatus for encoding a video signal according to the present invention, the current block may include a plurality of sub-blocks, and the offset may be set to a different value for each sub-block.
[0021] In the method and apparatus for encoding a video signal according to the present invention, an offset may be obtained according to reference samples adjacent to a current block.
[0022] According to the present invention, a method for decoding an image is provided, comprising: obtaining residual coefficients of a current block in the image from a bit stream; obtaining residual samples of the current block by performing inverse quantization and inverse transformation on the residual coefficients of the current block; performing intra-frame prediction on the current block to generate a first prediction sample of the current block; modifying the first prediction sample of the current block using a second prediction sample, the second prediction sample representing a sample belonging to the same current block as the first prediction sample; and reconstructing the current block based on the residual sample and the modified first prediction sample.
[0023] According to the present invention, a method for encoding an image is provided, comprising: obtaining a residual sample of a current block in the image based on a difference between an original sample and a predicted sample corresponding to the residual sample; performing transformation and quantization on the residual sample of the current block to generate a residual coefficient of the current block; and generating a bit stream by encoding the residual coefficient of the current block, wherein the predicted sample is obtained by modifying a first predicted sample of the current block using a second predicted sample included in the current block that is the same as the first predicted sample, and wherein the first predicted sample is obtained by performing intra-frame prediction on the current block.
[0024] According to the present invention, there is provided an apparatus including a bitstream generated by encoding an image, wherein the bitstream includes residual coefficients of a current block in the image, wherein the residual coefficients of the current block are generated by performing transformation and quantization on the residual samples of the current block, wherein the residual samples of the current block are obtained based on a difference between an original sample and a predicted sample corresponding to the residual sample, wherein the predicted sample is obtained by modifying a first predicted sample of the current block using a second predicted sample included in the same current block as the first predicted sample, and wherein the first predicted sample is obtained by performing intra-frame prediction on the current block.
[0025] Beneficial Effects
[0026] According to the present invention, the coding efficiency can be improved by hierarchical / adaptive partitioning of coding blocks.
[0027] According to the present invention, it is possible to effectively determine an intra prediction mode of an encoding / decoding target block and improve the accuracy of intra prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0029] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0030] Figure 3 is a view illustrating an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0031] Figure 4 is a view illustrating types of predefined intra prediction modes of an apparatus for encoding / decoding a video according to an embodiment of the present invention.
[0032] Figure 5 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0033] Figure 6 is a view illustrating a method of correcting a prediction sample of a current block based on differential information of adjacent samples according to an embodiment of the present invention.
[0034] Figure 7 and Figure 8 is a view illustrating a method of correcting a prediction sample based on a predetermined correction filter according to an embodiment of the present invention.
[0035] Fig. 9 is a view illustrating a method of correcting a prediction sample using a weight and an offset according to an embodiment of the present invention.
[0036] Figures 10 to 15 is a view illustrating a method of composing templates to determine a weight w according to an embodiment of the present invention.
[0037] Fig.16 is a view illustrating a method of correcting a prediction sample based on an offset according to an embodiment of the present invention.
[0038] Figures 17 to 21 is a view showing an example of an intra prediction method of a current block according to an embodiment of the present invention.
[0039] Fig. 22 is a view illustrating a method of performing prediction using an intra block copy technique according to an embodiment of the present invention.
[0040] Fig.23 is a flow chart showing the process of encoding a symbol.
[0041] Fig.24 is a view showing an example of dividing an interval between [0, 1) into sub-intervals based on the occurrence probability of a symbol.
[0042] Fig.25 is a view showing an example of setting a probability index according to the position of a block to be encoded.
[0043] Fig.26 and Fig. 27 is a diagram showing an example of division into tiles and fragments.
[0044] Fig.28 is a view showing an example of differently determining an initial probability index for each block.
[0045] Best Mode for Carrying Out the Invention
[0046] According to the present invention, a method and apparatus for decoding a video signal are provided, the method comprising: generating a first prediction sample by performing intra-frame prediction on a current block; determining an intra-frame prediction mode that specifies the way in which the current block is divided into sub-blocks; determining an offset in a sub-block unit of the current block based on the intra-frame prediction mode; and generating a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0047] In the method and apparatus for decoding a video signal according to the present invention, a current block may include a plurality of sub-blocks, and it may be determined whether to set an offset for each sub-block.
[0048] In the method and apparatus for decoding a video signal according to the present invention, whether to set an offset for a sub-block may be determined based on the position of the sub-block.
[0049] In the method and apparatus for decoding a video signal according to the present invention, the current block may include a plurality of sub-blocks, and the offset may be set to a different value for each sub-block.
[0050] In the method and apparatus for decoding a video signal according to the present invention, an offset may be obtained according to reference samples adjacent to a current block.
[0051] According to the present invention, a method and apparatus for encoding a video signal are provided, the method comprising: generating a first prediction sample by performing intra-frame prediction on a current block; determining an intra-frame prediction mode that specifies the way in which the current block is divided into sub-blocks; determining an offset in a sub-block unit of the current block based on the intra-frame prediction mode; and generating a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0052] In the method and apparatus for encoding a video signal according to the present invention, a current block may include a plurality of sub-blocks, and it may be determined whether to set an offset for each sub-block.
[0053] In the method and apparatus for encoding a video signal according to the present invention, whether to set an offset for a sub-block may be determined based on the position of the sub-block.
[0054] In the method and apparatus for encoding a video signal according to the present invention, the current block may include a plurality of sub-blocks, and the offset may be set to a different value for each sub-block.
[0055] In the method and apparatus for encoding a video signal according to the present invention, an offset may be obtained according to reference samples adjacent to a current block. DETAILED DESCRIPTION
[0056] 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 they 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.
[0057] 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.
[0058] 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 to 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.
[0059] 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.
[0060] 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.
[0061] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.
[0062] 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.
[0063] Figure 1 The components shown are shown independently to represent the characteristic functions that are different from each other in the device for encoding the video. Therefore, this 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 of 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.
[0064] In addition, some of the components may not be indispensable components for performing the basic functions of the present invention, but optional components that only improve 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 that only improve performance and only include indispensable components are also included in the scope of the present invention.
[0065] The picture partition module 110 may partition an input picture into one or more processing units. Here, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture partition module 110 may partition a picture into a combination of 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).
[0066] 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 a root can be divided in a manner that 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.
[0067] Hereinafter, in an embodiment of the present invention, a coding unit may mean a unit that performs encoding or a unit that performs decoding.
[0068] The prediction unit may be split into at least one square shape or rectangular shape having the same size in a single coding unit, or the prediction unit may be split such that: one split prediction unit in a single coding unit has a different shape and / or size from another split prediction unit.
[0069] 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.
[0070] 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 inter-frame prediction or intra-frame prediction is performed 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 fully encoded without generating a prediction block through the prediction modules 120 and 125 to transmit to a device for decoding a video.
[0071] 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.
[0072] 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.
[0073] 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 a motion vector, various methods (e.g., a full search based block matching algorithm (FBMA), a three-step search (TSS), and a new three-step search algorithm (NTS), etc.) can be used. Based on the interpolated pixel, 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 (e.g., a skip method, a merge method, an AMVP (Advanced Motion Vector Prediction) method, an intra-frame block copy method, etc.) can be used.
[0074] 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.
[0075] 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.
[0076] 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 with N×N partitioning can be used only for the minimum coding unit.
[0077] 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 flag information may be used to transmit information indicating that the prediction mode of the current prediction unit and the prediction mode of the adjacent prediction unit are the same as each other. When the prediction mode of the current prediction unit is different from the prediction mode of the adjacent prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.
[0078] 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.
[0079] 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.
[0080] The quantization module 135 may quantize the value transformed to the frequency domain by the transform module 130. The quantization coefficient may be different according to the block or importance of the picture. The value calculated by the quantization module 135 may be provided to the inverse quantization module 140 and the rearrangement module 160.
[0081] The rearrangement module 160 may rearrange coefficients of the quantized residual value.
[0082] The rearrangement module 160 can change the coefficient of the two-dimensional block form into the coefficient of the one-dimensional vector form by the coefficient scanning method. For example, the rearrangement module 160 can use the zigzag scanning method to scan from the DC coefficient to the coefficient of the high frequency domain so that the coefficient is changed 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 coefficient of the two-dimensional block form along the column direction or the horizontal direction scanning of the coefficient 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.
[0083] 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).
[0084] The entropy coding module 165 can encode various information from the rearrangement module 160 and the prediction modules 120 and 125 (for example, 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.).
[0085] The entropy encoding module 165 may entropy encode coefficients of the coding unit input from the rearrangement module 160 .
[0086] 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.
[0087] The filter module 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0088] 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.
[0089] The offset correction module can correct the offset of the picture to be deblocked from the original picture in units of pixels. 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: dividing the pixels of the picture into a predetermined number of regions, determining the region to perform the offset, and applying the offset to the determined region.
[0090] 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 ALF is applied and a luminance signal can be transmitted by a coding unit (CU). The shape and filter coefficients of the filter used for ALF can be different for each block. In addition, regardless of the characteristics of the application target block, the filter for ALF of the same shape (fixed shape) can be applied.
[0091] 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.
[0092] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.
[0093] 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 .
[0094] 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.
[0095] 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.
[0096] The entropy decoding module 210 may decode information about intra prediction and inter prediction performed by the apparatus for encoding a video.
[0097] 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 perform rearrangement by receiving information related to coefficient scanning performed in the apparatus for encoding a video, and may perform rearrangement by inversely scanning the coefficients based on the scanning order performed in the apparatus for encoding a video.
[0098] 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.
[0099] The inverse transform module 225 can perform an inverse transform (i.e., inverse DCT, inverse DST, and inverse KLT) on the quantization result performed by the device for encoding the video, that is, the inverse process of the transform performed by the transform module, i.e., DCT, DST, and KLT. The inverse transform can be performed based on the transform unit determined by the device for encoding the video. The inverse transform module 225 of the device for decoding the video can selectively perform a transform scheme (e.g., DCT, DST, KLT) according to multiple pieces of information (e.g., prediction method, size of the current block, prediction direction, etc.).
[0100] The prediction modules 230 and 235 may generate a prediction block based on information on prediction block generation received from the entropy decoding module 210 and previously decoded block or picture information received from the memory 245 .
[0101] 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 can be used only for the minimum coding unit.
[0102] 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 (e.g., prediction unit information, prediction mode information of an intra-frame prediction method, information on 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 about 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 about some pre-reconstructed areas in the current picture including the current prediction unit.
[0103] In order to perform inter prediction, which one of the skip mode, the merge mode, the AMVP mode, and the inter block copy mode to use as a motion prediction method of a prediction unit included in the coding unit may be determined for a coding unit.
[0104] 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.
[0105] 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.
[0106] 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.
[0107] 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. A 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 a corresponding block.
[0108] 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.
[0109] The AFL may be applied to the coding unit based on information on whether the ALF is applied and 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.
[0110] 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.
[0111] As described above, in the embodiments of the present invention, for convenience of explanation, a coding unit is used as a term representing a coding unit, however, a coding unit may be used as a unit that performs decoding as well as encoding.
[0112] Figure 3 is a view illustrating an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.
[0113] The input video signal is decoded in a predetermined block unit. Such a default unit for decoding the input video signal is a coding block. A coding block may be a block that performs intra / inter prediction, transformation, and quantization. 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 more.
[0114] Specifically, the coding block can be hierarchically divided based on at least one of a quadtree and a binary tree. Here, quadtree-based division may mean dividing a 2N×2N coding block into four N×N coding blocks, and binary tree-based division may mean dividing one coding block into two coding blocks. Binary tree-based division can be performed symmetrically or asymmetrically. The coding block based on binary tree division may be a square block or a non-square block (e.g., a rectangular shape). Binary tree-based division may be performed on the coding block for which quadtree-based division is no longer performed. Quadtree-based division may no longer be performed on the coding block based on binary tree division.
[0115] In order to implement adaptive partitioning based on quadtree or binary tree, the following information may be used: information indicating quadtree-based partitioning, information about the size / depth of coding blocks for which quadtree-based partitioning is allowed, information indicating binary tree-based partitioning, information about the size / depth of coding blocks for which binary tree-based partitioning is allowed, information about the size / depth of coding blocks for which binary tree-based partitioning is not allowed, information about whether binary tree-based partitioning is performed in a vertical direction or a horizontal direction, etc.
[0116] like Figure 3 As shown, the first coding block 300 with a partition depth (split depth) of k can be divided into multiple second coding blocks based on a quadtree. For example, the second coding blocks 310 to 340 can be square blocks with half the width and half the height of the first coding block, and the partition depth of the second coding block can be increased to k+1.
[0117] The second coding block 310 having a split depth of k+1 may be split into a plurality of third coding blocks having a split depth of k+2. The splitting of the second coding block 310 may be performed by selectively using one of a quadtree and a binary tree according to a splitting method. Here, the splitting method may be determined based on at least one of information indicating a quadtree-based splitting and information indicating a binary tree-based splitting.
[0118] When the second coding block 310 is divided based on a quadtree, the second coding block 310 may be divided into four third coding blocks 310a having half the width and half the height of the second coding block, and the division depth of the third coding block 310a may 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 may be divided into two third coding blocks. Here, each of the two third coding blocks may be a non-square block having half the width and half the height of the second coding block, and the division depth may be increased to k+2. The second coding block may be determined as a non-square block in the horizontal direction or the vertical direction according to the division direction, and the division direction may be determined based on information about whether the binary tree-based division is performed in the vertical direction or in the horizontal direction.
[0119] At the same time, the second coding block 310 may be determined as a leaf coding block that is no longer partitioned based on a quadtree or a binary tree. In this case, the leaf coding block may be used as a prediction block or a transform block.
[0120] 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.
[0121] At the same time, the third coding block 310b based on the binary tree division can be further divided into a coding block 310b-2 in the vertical direction or a coding block 310b-3 in the horizontal direction based on the binary tree, and the division depth of the relevant coding block can be increased to k+3. Alternatively, the third coding block 310b can be determined as a leaf coding block 310b-1 that is no longer based on the binary tree division. In this case, the coding block 310b-1 can be used as a prediction block or a transform block. However, the above-mentioned division processing can be performed restrictively based on at least one of the following information: information about the size / depth of the coding block that allows quadtree-based division, information about the size / depth of the coding block that allows binary tree-based division, and information about the size / depth of the coding block that does not allow binary tree-based division.
[0122] Figure 4 is a view illustrating types of predefined intra prediction modes of an apparatus for encoding / decoding a video according to an embodiment of the present invention.
[0123] The apparatus for encoding / decoding a video may perform intra prediction using one of the predefined intra prediction modes. The predefined intra prediction modes for intra prediction may include a non-directional prediction mode (eg, planar mode, DC mode) and 33 directional prediction modes.
[0124] Alternatively, in order to improve the accuracy of intra-frame prediction, a larger number of directional prediction modes than 33 directional prediction modes can be used. That is, M extended directional prediction modes (M>33) can be defined by subdividing the angle of the directional prediction mode, and at least one of the 33 predefined directional prediction modes can be used to obtain a directional prediction mode with a predetermined angle.
[0125] Figure 4 An example of an extended intra prediction mode is shown, and the extended intra prediction mode may include two non-directional prediction modes and 65 extended directional prediction modes. The same number of extended intra prediction modes may be used for luma components and chroma components, or a different number of intra prediction modes may be used for each component. For example, 67 extended intra prediction modes may be used for luma components, and 35 intra prediction modes may be used for chroma components.
[0126] Alternatively, depending on the chroma format, different numbers of intra prediction modes may be used when performing intra prediction. For example, in the case of a 4:2:0 format, 67 intra prediction modes may be used for the luma component to perform intra prediction, and 35 intra prediction modes may be used for the chroma component. In the case of a 4:4:4 format, 67 intra prediction modes may be used for both the luma component and the chroma component to perform intra prediction.
[0127] Alternatively, depending on the size and / or shape of the block, different numbers of intra prediction modes may be used to perform intra prediction. That is, depending on the size and / or shape of the PU or CU, 35 intra prediction modes or 67 intra prediction modes may be used to perform intra prediction. For example, when the CU or PU has a size less than 64×64 or is divided asymmetrically, 35 intra prediction modes may be used to perform intra prediction. When the size of the CU or PU is equal to or greater than 64×64, 67 intra prediction modes may be used to perform intra prediction. For Intra_2N×2N, 65 directional intra prediction modes may be allowed, and for Intra_N×N, only 35 directional intra prediction modes may be allowed.
[0128] Figure 5 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.
[0129] Reference Figure 5 , the intra prediction mode of the current block may be determined at step S500.
[0130] Specifically, the intra prediction mode of the current block can be obtained based on the candidate list and the index. Here, the candidate list includes multiple candidates, and multiple candidates can be determined based on the intra prediction mode of the adjacent blocks adjacent to the current block. The adjacent blocks may include at least one of the blocks located on the upper side, lower side, left side, right side and corner of the current block. The index can specify one candidate among the multiple candidates in the candidate list. The candidate specified by the index can be set to the intra prediction mode of the current block.
[0131] The intra prediction mode used for intra prediction in the adjacent block may be set as a candidate. In addition, an intra prediction mode having a directionality similar to that of the intra prediction mode of the adjacent block may be set as a candidate. Here, the intra prediction mode having similar directionality may be determined by adding a predetermined constant value to the intra prediction mode of the adjacent block or subtracting a predetermined constant value from the intra prediction mode of the adjacent block. The predetermined constant value may be an integer (e.g., one, two, or more).
[0132] The candidate list may also include a default mode. The default mode may include at least one of a planar mode, a DC mode, a vertical mode, and a horizontal mode. The default mode may be adaptively added in consideration of the maximum number of candidates that may be included in the candidate list of the current block.
[0133] The maximum number of candidates that can be included in the candidate list can be three, four, five, six or more. The maximum number of candidates that can be included in the candidate list can be a fixed value preset in a device for encoding / decoding a video, or can be variably determined based on the characteristics of the current block. The characteristics can mean the position / size / shape of the block, the number / type of intra-frame prediction modes that the block can use, etc. Alternatively, information indicating the maximum number of candidates that can be included in the candidate list can be separately signaled, and the information can be used to variably determine the maximum number of candidates that can be included in the candidate list. The information indicating the maximum number of candidates can be signaled at at least one of a sequence level, a picture level, a slice level, and a block level.
[0134] When the extended intra prediction mode and the 35 predefined intra prediction modes are selectively used, the intra prediction mode of the adjacent block can be transformed into an index corresponding to the extended intra prediction mode, or transformed into an index corresponding to the 35 intra prediction modes, thereby obtaining a candidate. In order to transform into an index, a predefined table can be used, or a scaling operation based on a predetermined value can be used. Here, the predefined table can define a mapping relationship between different intra prediction mode groups (e.g., extended intra prediction mode and 35 intra prediction modes).
[0135] For example, when the left neighboring block uses 35 intra prediction modes and the intra prediction mode of the left neighboring block is 10 (horizontal mode), the intra prediction mode may be transformed into index 16 corresponding to the horizontal mode in the extended intra prediction mode.
[0136] Alternatively, when the upper neighboring block uses the extended intra prediction mode and the intra prediction mode of the upper neighboring block has an index of 50 (vertical mode), the intra prediction mode may be transformed into an index of 26 corresponding to the vertical mode among the 35 intra prediction modes.
[0137] Based on the above method of determining the intra prediction mode, the intra prediction mode may be independently obtained for each of the luminance component and the chrominance component, or the intra prediction mode of the chrominance component may be obtained according to the intra prediction mode of the luminance component.
[0138] Specifically, as shown in Table 1 below, the intra prediction mode of the chrominance component may be determined based on the intra prediction mode of the luminance component.
[0139] [Table 1]
[0140]
[0141]
[0142] In Table 1, intra_chroma_pred_mode means information signaled to specify an intra prediction mode of a chroma component, and IntraPredModeY indicates an intra prediction mode of a luma component.
[0143] Reference Figure 5 , at step S510, a reference sample for intra prediction of the current block may be obtained.
[0144] Specifically, reference samples for intra prediction may be obtained based on neighboring samples of the current block. The neighboring samples may be reconstructed samples of neighboring blocks, and the reconstructed samples may be reconstructed samples before applying a loop filter or reconstructed samples after applying a loop filter.
[0145] The adjacent samples reconstructed before the current block may be used as reference samples, and the adjacent samples filtered based on a predetermined intra-frame filter may be used as reference samples. The intra-frame filter may include at least one of a first intra-frame filter applied to a plurality of adjacent samples located on the same horizontal line and a second intra-frame filter applied to a plurality of adjacent samples located on the same vertical line. Depending on the position of the adjacent samples, one of the first intra-frame filter and the second intra-frame filter may be selectively applied, or both intra-frame filters may be applied.
[0146] Filtering may be adaptively performed based on at least one of the intra prediction mode of the current block and the size of the transform block of the current block. For example, when the intra prediction mode of the current block is a DC mode, a vertical mode, or a horizontal mode, filtering may not be performed. When the size of the transform block is N×M, filtering may not be performed. Here, N and M may be the same value or different values, or may be 4, 8, 16 or greater. Alternatively, filtering may be selectively performed based on the result of comparing a predefined threshold with the difference between the intra prediction mode of the current block and the vertical mode (or horizontal mode). For example, filtering may be performed when the difference between the intra prediction mode of the current block and the vertical mode is greater than a threshold. As shown in Table 2, a threshold may be defined for each size of the transform block.
[0147] [Table 2]
[0148] 8×8 Transform 16×16 Transform 32×32 Transform Threshold 7 1 0
[0149] The intra filter may be determined as one of a plurality of intra filter candidates predefined in a device for encoding / decoding a video. To this end, an index of an intra filter for a current block among a plurality of intra filter candidates may be transmitted by a signal. Alternatively, the intra filter may be determined based on at least one of the following: the size / shape of the current block, the size / shape of the transform block, information about filter strength, and a change in neighboring samples.
[0150] Reference Figure 5 At step 520, intra prediction may be performed using the intra prediction mode and reference samples of the current block.
[0151] That is, the prediction sample of the current block can be obtained using the intra prediction mode determined at step S500 and the reference sample obtained at step S510. However, in the case of intra prediction, the boundary samples of the adjacent blocks can be used, and thus the quality of the predicted picture may be reduced. Therefore, correction processing can be performed on the prediction samples generated by the above prediction processing, and the reference samples can be used as the reference samples. Figures 6 to 15 However, the correction process is not limited to being applied only to intra-prediction samples, and the correction process may be applied to inter-prediction samples or reconstructed samples.
[0152] Figure 6 is a view illustrating a method of correcting a prediction sample of a current block based on differential information of adjacent samples according to an embodiment of the present invention.
[0153] The prediction samples of the current block may be corrected based on differential information of a plurality of adjacent samples of the current block. The correction may be performed on all prediction samples in the current block, or may be performed on predetermined samples in some predetermined areas. Some areas may be one row / column or a plurality of rows / columns, or may be a preset area for correction in an apparatus for encoding / decoding a video, or may be variably determined based on at least one of a size / shape of the current block and an intra prediction mode.
[0154] The neighboring samples may belong to a neighboring block located at the upper side, the left side, or the upper left corner of the current block. The number of neighboring samples used for correction may be two, three, four, or more. The positions of the neighboring samples may be variably determined according to the positions of the prediction samples as the correction target in the current block. Alternatively, some of the neighboring samples may have fixed positions regardless of the positions of the prediction samples as the correction target, and the remaining neighboring samples may have variable positions according to the positions of the prediction samples as the correction target.
[0155] The difference information of the adjacent samples may mean the difference samples between the adjacent samples, or may mean a value obtained by scaling the difference samples by a predetermined constant value (e.g., one, two, three, etc.). Here, the predetermined constant value may be determined in consideration of the position of the prediction sample as the correction target, the position of the row or column including the prediction sample as the correction target, the position of the prediction sample within the row or column, etc.
[0156] For example, when the intra prediction mode of the current block is a vertical mode, as shown in Formula 1, the final prediction sample can be obtained using the difference sample between the upper left adjacent sample p(-1,-1) and the adjacent sample p(-1,y) adjacent to the left boundary of the current block. (y=0...N-1)
[0157] [Formula 1]
[0158] P′(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1
[0159] For example, when the intra prediction mode of the current block is the horizontal mode, as shown in Formula 2, the final prediction sample can be obtained using the difference sample between the upper left adjacent sample p(-1,-1) and the adjacent sample p(x,-1) adjacent to the upper boundary of the current block. (x=0...N-1)
[0160] [Formula 2]
[0161] P′(x,0)=p(x,0)+((p(x,-1)-p(-1,-1))>>1
[0162] For example, when the intra prediction mode of the current block is a vertical mode, the final prediction sample can be obtained using the difference sample between the upper left adjacent sample p(-1,-1) and the adjacent sample p(-1,y) adjacent to the left boundary of the current block. Here, the difference sample can be added to the prediction sample, or the difference sample can be scaled by a predetermined constant value and then added to the prediction sample. The predetermined constant value used in scaling can be determined differently according to rows and / or columns. For example, the prediction sample can be corrected as shown in Formula 3 and Formula 4. (y=0...N-1)
[0163] [Formula 3]
[0164] P′(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1
[0165] [Formula 4]
[0166] P'(1,y)=P(1,y)+((p(-1,y)-p(-1,-1))>>2
[0167] For example, when the intra prediction mode of the current block is a horizontal mode, the final prediction sample can be obtained as described in the case of the vertical mode using the difference sample between the upper left neighboring sample p(-1,-1) and the neighboring sample p(x,-1) adjacent to the upper boundary of the current block. For example, the prediction sample can be corrected as shown in Formula 5 and Formula 6. (x=0...N-1)
[0168] [Formula 5]
[0169] P′(x,0)=p(x,0)+((p(x,-1)-p(-1,-1))>>1
[0170] [Formula 6]
[0171] P′(x,1)=p(x,1)+((p(x,-1)-p(-1,-1))>>2
[0172] Figure 7 and Figure 8 is a view illustrating a method of correcting a prediction sample based on a predetermined correction filter according to an embodiment of the present invention.
[0173] The prediction sample may be corrected based on the neighboring samples of the prediction sample as the correction target and a predetermined correction filter. Here, the neighboring samples may be specified by the angle line of the directional prediction mode of the current block, or the neighboring samples may be at least one sample located on the same angle line as the prediction sample as the correction target. In addition, the neighboring samples may be the prediction samples in the current block, or may be the reconstructed samples in the neighboring blocks reconstructed before the current block.
[0174] At least one of the number of taps, strength, and filter coefficients of the correction filter can be determined based on at least one of the following: the position of the prediction sample as the correction target, whether the prediction sample as the correction target is located at the boundary of the current block, the intra-frame prediction mode of the current block, the angle of the directional prediction mode, the prediction mode of the adjacent block (inter-frame mode or intra-frame mode), and the size / shape of the current block.
[0175] Reference Figure 7 , when the directional prediction mode has an index of 2 or 34, a final prediction sample may be obtained using at least one prediction / reconstruction sample located at the lower left side of the prediction sample as a correction target and a predetermined correction filter. Here, the prediction / reconstruction sample at the lower left side may belong to a previous row of a row including the prediction sample as a correction target. The prediction / reconstruction sample at the lower left side may belong to the same block as the current sample, or to a neighboring block adjacent to the current block.
[0176] The filtering of the prediction samples may be performed only on the rows located at the block boundary, or may be performed on multiple rows. A correction filter different for each row may be used, at least one of the number of filter taps and the filter coefficient. For example, a (1 / 2, 1 / 2) filter may be used for the first row on the left closest to the block boundary, a (12 / 16, 4 / 16) filter may be used for the second row, a (14 / 16, 2 / 16) filter may be used for the third row, and a (15 / 16, 1 / 16) filter may be used for the fourth row.
[0177] Alternatively, when the directional prediction mode has an index of 3 to 6 or 30 to 33, it may be as follows Figure 8 Filtering is performed on the block boundary as shown, and a 3-tap correction filter can be used to correct the prediction sample. The filtering can be performed using the lower left sample of the prediction sample as the correction target, the lower sample of the lower left sample, and a 3-tap correction filter that takes the prediction sample as the correction target as input. The position of the adjacent sample used by the correction filter can be determined differently based on the directional prediction mode. The filter coefficient of the correction filter can be determined differently according to the directional prediction mode.
[0178] Different correction filters can be applied depending on whether the neighboring blocks are encoded in inter-frame mode or intra-frame mode. When the neighboring blocks are encoded in intra-frame mode, a filtering method that gives more weight to the prediction samples can be used than when the neighboring blocks are encoded in inter-frame mode. For example, in the case where the intra-frame prediction mode is 34, when the neighboring blocks are encoded in inter-frame mode, a (1 / 2, 1 / 2) filter can be used, and when the neighboring blocks are encoded in intra-frame mode, a (4 / 16, 12 / 16) filter can be used.
[0179] The number of rows to be filtered in the current block may be different depending on the size / shape of the current block (e.g., a coding block or a prediction block). For example, when the size of the current block is equal to or less than 32×32, filtering may be performed only on one row at the block boundary; otherwise, filtering may be performed on multiple rows including one row at the block boundary.
[0180] Figure 7 and Figure 8 Based on which Figure 4 The present invention is about the case where 35 intra prediction modes are used, but can also be equally / similarly applied to the case where the extended intra prediction mode is used.
[0181] Fig. 9 is a view illustrating a method of correcting a prediction sample using a weight and an offset according to an embodiment of the present invention.
[0182] Since the brightness between the previous frame and the current frame changes, even if the current block is similar to the collocated block of the previous frame, there may be a case where it is not encoded with intra-frame prediction or inter-frame prediction, or there may be a case where the quality of the predicted picture encoded with intra-frame prediction or inter-frame prediction may be relatively low. In this case, the weight and offset for brightness compensation can be applied to the predicted sample so that the quality of the predicted picture can be improved.
[0183] Reference Fig. 9 , at step S900, at least one of a weight w and an offset f may be determined.
[0184] At least one of the weight w and the offset f may be signaled in at least one of a sequence parameter set, a picture parameter set, and a slice header. Alternatively, at least one of the weight w and the offset f may be signaled in a predetermined block unit sharing the same weight w and offset f, and a plurality of blocks (e.g., CU, PU, and TU) belonging to the predetermined block unit may share one signaled weight w and / or offset f.
[0185] At least one of the weight w and the offset f may be signaled regardless of the prediction mode of the current block, or may be selectively signaled in consideration of the prediction mode. For example, when the prediction mode of the current block is an inter-frame mode, the weight w and / or the offset f may be signaled; otherwise, the weight w and / or the offset f may not be signaled. Here, the inter-frame mode may include at least one of a skip mode, a merge mode, an AMVP mode, and a current picture reference mode. The current picture reference mode may mean a prediction mode using a pre-reconstructed region in a current picture including the current block. The pre-reconstructed region may be specified using a motion vector for the current picture reference mode. A flag or index indicating whether the current block is encoded in the current picture reference mode may be signaled, or the flag or index may be obtained by the reference picture index of the current block. The current picture for the current picture reference mode may be present at a fixed position (e.g., a position of refIdx=0 or the last position) in the reference picture list of the current block. Alternatively, the current picture may be located at a different position in the reference picture list, and for this purpose, a separate reference picture index indicating the position of the current picture may be signaled.
[0186] The weight may be obtained using a brightness change between a first template of a specific shape adjacent to the current block and a second template corresponding to the specific shape adjacent to the previous block. The second template may include unavailable samples. In this case, the available samples may be copied to the location of the unavailable samples, or available samples obtained by interpolating between a plurality of available samples may be used. Here, the available samples may be included in the second template or the adjacent block. At least one of the coefficients, shape, and number of taps of the filter used for interpolation may be variably determined based on the size and / or shape of the template. Figures 10 to 15 To describe in detail the method of composing templates.
[0187] For example, when the neighboring samples of the current block are i (i ranges from 0 to N-1) and the adjacent samples of the parallel block are specified by x i (i ranges from 0 to N-1) When specified, the weight w and offset f can be obtained as follows.
[0188] Using a template of a specific shape adjacent to the current block, the weight w and offset f can be obtained by obtaining the minimum value of E(w,f) in Formula 7.
[0189] [Formula 7]
[0190] E(w,f)=∑ i (p i -(wp i -f)) 2 +λ(w-1)2
[0191] Formula 7 for obtaining the minimum value can be changed to Formula 8.
[0192] [Formula 8]
[0193]
[0194] Formula 9 for obtaining the weight w and Formula 10 for obtaining the offset f can be obtained according to Formula 8.
[0195] [Formula 9]
[0196]
[0197] [Formula 10]
[0198] f=∑ i y i -a*∑ i x i
[0199] Reference Fig. 9 , the prediction sample may be corrected using at least one of the weight and the offset determined at step S900.
[0200] For example, when the brightness changes in all frames, the weight w and the offset f are applied to the prediction sample p generated by intra prediction, so that the corrected prediction sample p' can be obtained as shown in Formula 11.
[0201] [Formula 11]
[0202] p′=w×p+f
[0203] Here, the weight w and the offset f may be applied to a prediction sample generated by inter prediction, or may be applied to a reconstructed sample.
[0204] Figures 10 to 15 is a view illustrating a method of composing templates to determine a weight w according to an embodiment of the present invention.
[0205] Reference Fig.10 On the left side of , the template may consist of all neighboring samples adjacent to the current block, or the template may consist of some samples subsampled from neighboring samples adjacent to the current block. Fig.10 The middle part of FIG shows an example of 1 / 2 subsampling, and the template can be composed of only gray samples. Instead of 1 / 2 subsampling, 1 / 4 subsampling or 1 / 8 subsampling can be used to compose the template. Fig.10 As shown on the right side of , except for the samples located on the upper left side, the template can be composed of all adjacent samples adjacent to the current block. Fig.10 What is not shown is that, considering the position of the current block in the picture or the coding tree block (largest coding unit), a template consisting of only samples located on the left side or a template consisting of only samples located on the upper side may be used.
[0206] Reference Fig.11 , the template can be formed by increasing the number of adjacent samples. That is, Fig.11 The template in may consist of first neighboring samples adjacent to a boundary of the current block and second neighboring samples adjacent to the first neighboring samples.
[0207] like Fig.11 As shown on the left side of , the template can consist of all adjacent samples belonging to the two rows adjacent to the boundary of the current block, or as Fig.11 As shown in the middle of , the template can be composed by subsampling the template on the left. Fig.11 As shown on the right side of , the four samples belonging to the upper left side can be excluded to form the template. Fig.11 What is not shown is that, considering the position of the current block in the picture or the coding tree block (largest coding unit), a template consisting of samples located only on the left side or a template consisting of samples located only on the upper side may be used.
[0208] Alternatively, different templates may be composed according to the size and / or shape of the current block (whether the current block has a square shape, whether the current block is symmetrically divided). Fig.12 As shown, the subsampling rate of the template can be applied differently according to the size of the current block. Fig.12 As shown on the left side of , when the block size is equal to or less than 64×64, a template that has been subsampled by 1 / 2 can be formed. Fig.12 As shown on the right side of , when the block size is equal to or greater than 128×128, a template that is subsampled by 1 / 4 can be formed.
[0209] Reference Fig.13 , a template can be composed by increasing the number of neighboring samples adjacent to the current block according to the size of the current block.
[0210] A plurality of template candidates that can be used in a sequence or a slice can be determined, and one of the plurality of template candidates can be selectively used. The plurality of template candidates can include templates having different shapes and / or sizes from each other. Information about the shape and / or size of the template can be transmitted by a signal in a sequence header or a slice header. In a device for encoding / decoding a video, an index can be assigned to each template candidate. In order to identify a template candidate to be used in a current sequence, picture, or slice among a plurality of template candidates, the syntax type_weight_pred_template_idx can be encoded. The device for decoding a video can selectively use the template candidate based on the syntax type_weight_pred_template_idx.
[0211] For example, Fig.14 As shown, Fig.10 The template in the middle can be assigned 0, Fig.10 The template on the right can be assigned 1, Fig.11 The middle template can be assigned 2, and Fig.11 The template on the right may be assigned 3. The template used in the sequence may be signaled.
[0212] When performing weighted prediction using non-square blocks, templates can be composed by applying different subsampling rates to the long and short edges so that the total number of templates is 2^N. Fig.15 As shown, the template can be composed by performing 1 / 2 subsampling on the short side and 1 / 4 subsampling on the long side.
[0213] When intra prediction is performed on the current block based on the directional intra prediction mode, the generated prediction samples may not reflect the characteristics of the original picture due to the limited range of the reference samples used (for example, only adjacent samples adjacent to the current block are used to perform intra prediction). For example, when there is an edge in the current block, or when a new object appears around the boundary of the current block, the difference between the prediction sample and the original picture may be large depending on the position of the prediction sample in the current block.
[0214] In this case, the residual value is relatively large, and thus the number of bits to be encoded / decoded may increase. In particular, the residual value in an area relatively far from the boundary of the current block may include a large amount of high-frequency components, which may result in a decrease in encoding / decoding efficiency.
[0215] In order to solve the above problem, a method of generating or updating prediction samples in sub-block units can be used, thereby improving the prediction accuracy in areas relatively far from the block boundary.
[0216] For ease of explanation, in the following embodiments, prediction samples generated based on directional intra prediction mode are referred to as first prediction samples. In addition, prediction samples generated based on non-directional intra prediction mode or prediction samples generated by performing inter prediction may also be included in the category of first prediction samples.
[0217] Will refer to Fig.16 A method of correcting prediction samples based on an offset is described in detail.
[0218] Fig.16 is a view illustrating a method of correcting a prediction sample based on an offset according to an embodiment of the present invention.
[0219] Reference Fig.16 , for the current block, it may be determined at step S1600 whether to use an offset to update the first prediction sample. Whether to use an offset to update the first prediction sample may be determined by a flag decoded from the bitstream. For example, the syntax 'is_sub_block_refinement_flag' indicating whether to use an offset to update the first prediction sample may be signaled through the bitstream. When the value of is_sub_block_refinement_flag is 1, a method of updating the first prediction sample using an offset may be used in the current block. When the value of is_sub_block_refinement_flag is zero, a method of updating the first prediction sample using an offset may not be used in the current block. However, step S1600 is intended to selectively perform an update of the first prediction sample and is not a necessary configuration for achieving the purpose of the present invention, so step S1600 may be omitted in some cases.
[0220] When it is determined to use the method of updating the first prediction sample using the offset, the intra prediction mode of the current block may be determined at step S1610. Through the intra prediction mode, all or some areas of the current block to which the offset is applied, the division shape of the current block, whether to apply the offset to the sub-blocks included in the current block, the size / sign of the offset allocated to each sub-block, etc. may be determined.
[0221] One of a plurality of modes predefined in a device for encoding / decoding a video may be selectively used as an intra prediction mode of the current block, and for this purpose, an index specifying the intra prediction mode of the current block may be transmitted by signal from a bitstream. As another example, the intra prediction mode of the current block may be determined based on the following: a division mode of a prediction unit or a coding unit of the current block, a size / shape of the block, whether it is a directional intra prediction mode, an angle of a directional intra prediction mode, etc.
[0222] Whether to signal an index indicating an intra prediction mode of a current block may be determined by predetermined flag information signaled from a bitstream. For example, when the flag information indicates that an index indicating an intra prediction mode of a current block is signaled from a bitstream, the intra prediction mode of the current block may be determined based on the index decoded from the bitstream. Here, the flag information may be signaled at least one of a picture level, a slice level, and a block level.
[0223] When the flag information indicates that the index indicating the intra prediction mode of the current block is not signaled from the bitstream, the intra prediction mode of the current block may be determined based on a division mode of a prediction unit or a coding unit of the current block, etc. For example, the current block may be divided into sub-blocks in the same manner as the coding block is divided into prediction units.
[0224] When the intra prediction mode of the current block is determined, the offset in the sub-block unit can be obtained at step S1620. The offset can be transmitted by signal in units of slices, coding units, or prediction units. As another example, the offset can be obtained based on adjacent samples of the current block. The offset may include at least one of offset value information and offset sign information. Here, the offset value information may be within an integer range equal to or greater than zero.
[0225] When the offset is determined, a second prediction sample may be obtained for each sub-block at step S1630. The second prediction sample may be obtained by applying the offset to the first prediction sample. For example, the second prediction sample may be obtained by adding the offset to the first prediction sample or subtracting the offset from the first prediction sample.
[0226] Figures 17 to 21 is a view showing an example of an intra prediction method of a current block according to an embodiment of the present invention.
[0227] For example, in Fig.17 In the example shown, when the index is "0" or "1", the current block can be divided into an upper sub-block and a lower sub-block. The offset may not be set for the upper sub-block, and the offset "f" may be set for the lower sub-block. Therefore, the first prediction sample (P(i, j)) can be used entirely in the upper sub-block, and the second prediction sample (P(i, j)+f or P(i, j)-f) generated by adding an offset to the first prediction sample or subtracting an offset from the first prediction sample can be used in the lower sub-block. In the present invention, "not set" may mean that the offset is not assigned to the block, or may mean that an offset with a value of "0" may be assigned to the block.
[0228] When the index is "2" or "3", the current block is divided into a left subblock and a right subblock. The offset may not be set for the left subblock, and the offset "f" may be set for the right subblock. Therefore, the first prediction sample (P(i, j)) may be used entirely in the left subblock, and the second prediction sample (P(i, j)+f or P(i, j)-f) generated by adding the offset to the first prediction sample or subtracting the offset from the first prediction sample may be used in the right subblock.
[0229] The range of available intra prediction modes may be limited based on the intra prediction mode of the current block. For example, when the intra prediction mode of the current block is a vertical intra prediction mode or a prediction mode in a direction similar to the vertical intra prediction mode (for example, among 33 directional prediction modes, when the intra prediction mode has indexes 22 to 30), only the intra prediction modes of the current block divided in the horizontal direction (for example, Fig.17 Index 0 or 1 in ) applies to the current block.
[0230] As another example, when the intra prediction mode of the current block is a horizontal direction intra prediction mode or a prediction mode in a direction similar to the horizontal direction intra prediction mode (for example, among the 33 directional prediction modes, when the intra prediction mode has indexes 6 to 14), only the intra prediction mode of the current block divided in the vertical direction (for example, Fig.17 Index 2 or Index 3 in (applies to the current block).
[0231] exist Fig.17 In the embodiment, an offset is not set for one of the sub-blocks included in the current block, and an offset is set for another sub-block. Whether to set an offset for a sub-block may be determined based on information transmitted with a signal for each sub-block.
[0232] Whether to set an offset for a sub-block may be determined based on the position of the sub-block, an index for identifying the sub-block in the current block, etc. For example, based on a predetermined boundary of the current block, an offset may not be set for a sub-block adjacent to the predetermined boundary, and an offset may be set for a sub-block not adjacent to the predetermined boundary.
[0233] When it is assumed that the predetermined boundary is the upper boundary of the current block, in the intra-frame prediction method corresponding to the index "0" or "1", the offset may not be set for the sub-block adjacent to the upper boundary of the current block, and the offset may be set for the sub-block not adjacent to the upper boundary of the current block.
[0234] When it is assumed that the predetermined boundary is the left boundary of the current block, in the intra-frame prediction method corresponding to the index "2" or "3", the offset may not be set for the sub-block adjacent to the left boundary of the current block, and the offset may be set for the sub-block not adjacent to the left boundary of the current block.
[0235] exist Fig.17In the example, it is assumed that no offset is set for one of the sub-blocks included in the current block, and an offset is set for another sub-block. As another example, different offset values may be set for the sub-blocks included in the current block.
[0236] Will refer to Fig.18 An example of setting a different offset for each sub-block is described below.
[0237] Reference Fig.18 , when the index is "0" or "1", an offset "h" may be set for the upper sub-block of the current block, and an offset "f" may be set for the lower sub-block of the current block. Therefore, a second prediction sample (P(i, j)+h or P(i, j)-h) obtained by adding an offset "h" to the first prediction sample or subtracting an offset "h" from the first prediction sample may be generated in the upper sub-block, and a second prediction sample (P(i, j)+f or P(i, j)-f) obtained by adding an offset "f" to the first prediction sample or subtracting an offset "f" from the first prediction sample may be generated in the lower sub-block.
[0238] Reference Fig.18 , when the index is "2" or "3", an offset "h" may be set for the left subblock of the current block, and an offset "f" may be set for the right subblock of the current block. Therefore, a second prediction sample (P(i, j) + h or P(i, j) - h) obtained by adding an offset "h" to the first prediction sample or subtracting an offset "h" from the first prediction sample may be generated in the left subblock, and a second prediction sample (P(i, j) + f or P(i, j) - f) obtained by adding an offset "f" to the first prediction sample or subtracting an offset "f" from the first prediction sample may be generated in the right subblock.
[0239] exist Fig.17 and Fig.18 In the present invention, the current block is divided into two sub-blocks having the same size, but the number of sub-blocks included in the current block and / or the size of the sub-blocks are not limited to Fig.17 and Fig.18 The example shown. The number of sub-blocks included in the current block may be three or more, and the sizes of the sub-blocks may be different.
[0240] When multiple intra prediction modes are available, the available intra prediction modes may be grouped into multiple categories. In this case, the intra prediction mode of the current block may be selected based on a first index for identifying the category and a second index for identifying the intra prediction mode in the category.
[0241] Will refer to Fig.19 An example of determining an intra prediction method of a current block based on a first index and a second index is described below.
[0242] exist Fig.19In the example shown, the 12 intra-frame prediction modes can be divided into three categories, each category including four intra-frame prediction modes. For example, the intra-frame prediction modes corresponding to indexes 0 to 3 can be classified as category 0, the intra-frame prediction modes corresponding to indexes 4 to 7 can be classified as category 1, and the intra-frame prediction modes corresponding to indexes 8 to 11 can be classified as category 2.
[0243] The apparatus for decoding a video may decode a first index from a bitstream to specify a category including at least one intra-frame prediction mode. Fig.19 In the example shown, the first index may specify one of categories 0, 1, and 2.
[0244] When the category is specified based on the first index, the intra prediction mode of the current block can be determined based on the second index decoded from the bitstream. When the first index specifies category 1, the second index can specify one of the four intra prediction modes of category 1 (ie, index 4 to index 7).
[0245] exist Fig.19 In , the categories include the same number of intra-frame prediction modes, but the categories do not necessarily include the same number of intra-frame prediction modes.
[0246] The number of available intra prediction modes or the number of categories may be determined in units of a sequence or a slice. In addition, at least one of the number of available intra prediction modes and the number of categories may be signaled through a sequence header or a slice header.
[0247] As another example, the number of available intra prediction modes and / or the number of categories may be determined based on the size of the prediction unit or coding unit of the current block. For example, when the size of the current block (e.g., the coding unit of the current block) is equal to or greater than 64×64, the number of available intra prediction modes and / or the number of categories may be determined based on the size of the prediction unit or coding unit of the current block. Fig. 20 Select the intra prediction mode of the current block from the five intra prediction modes shown in FIG. 1 . On the contrary, when the size of the current block (for example, the coding block of the current block) is smaller than 64×64, you can select the intra prediction mode of the current block from Fig.17 , Fig.18 or Fig.19 Select the intra-frame prediction mode for the current block from the intra-frame prediction modes shown.
[0248] exist Figures 17 to 20 In the example, the sub-blocks included in each intra prediction mode are rectangular in shape. As another example, intra prediction modes may be used in which at least one of the size and shape of the sub-blocks is different from each other. For example, Fig. 22 is a view showing an example of an intra prediction method for subblocks having different sizes and shapes.
[0249] The offset of each sub-block (e.g. Figures 17 to 21The offset h, f, g or i) of each sub-block shown in FIG. 5 can be decoded from the bitstream, or can be obtained from neighboring samples adjacent to the current block.
[0250] As another example, the offset of the sub-block may be determined considering the distance from the sample at a specific position in the current block. For example, the offset may be determined in proportion to a value representing the distance between the sample at a predetermined position in the current block and the sample at a predetermined position in the sub-block.
[0251] As another example, the offset of the subblock may be determined by adding or subtracting a value determined based on a distance between a sample at a predetermined position in the current block and a sample at a predetermined position in the subblock.
[0252] As another example, the offset may be determined based on a ratio of a value representing the size of the current block and a value representing a distance between a sample at a predetermined position in the current block and a sample at a predetermined position in the sub-block.
[0253] Here, the samples at the predetermined position in the current block may include samples adjacent to the left boundary of the current block, samples located at the upper boundary of the current block, samples adjacent to the upper left corner of the current block, and the like.
[0254] Fig. 22 is a view illustrating a method of performing prediction using an intra block copy technique according to an embodiment of the present invention.
[0255] Intra-block copy (IBC) is a method of predicting / reconstructing a current block using a block that has been reconstructed in the same picture as the current block (hereinafter referred to as a "reference block"). Intra-block copy can improve encoding / decoding performance when a picture contains a large amount of text (e.g., Korean letters, letters, etc.) and the text contained when reconstructing the current block is contained in an already decoded block.
[0256] The intra-block copy method may be classified as an intra-prediction method or an inter-prediction method. When the intra-block copy method is classified as an intra-prediction method, an intra-prediction mode for the intra-block copy method may be defined. When the intra-block copy method is classified as an inter-prediction method, the bitstream may include a flag indicating whether the intra-block copy method is applied to the current block. Alternatively, whether the current block uses intra-block copying may be confirmed by a reference picture index of the current block. That is, when the reference picture index of the current block indicates the current picture, inter-prediction may be performed on the current block using intra-block copying. To this end, a pre-reconstructed current picture may be added to a reference picture list of the current block. The current picture may exist at a fixed position (e.g., a position where the reference picture index is 0 or the last position) in the reference picture list. Alternatively, the current picture may exist variably in the reference picture list, and to this end, a separate reference picture index indicating the position of the current picture may be transmitted by a signal.
[0257] In order to specify a reference block of a current block, a position difference between the current block and the reference block may be defined as a motion vector (hereinafter referred to as a block vector).
[0258] The block vector may be obtained by summing the predicted block vector and the differential block vector. The apparatus for encoding a video may generate a predicted block vector by predictive encoding, and may encode a differential block vector indicating a difference between the block vector and the predicted block vector. In this case, the apparatus for decoding a video may obtain a block vector of a current block by using the predicted block vector obtained using pre-decoded information and the differential block vector decoded from a bitstream.
[0259] Here, the predicted block vector may be obtained based on: a block vector of a neighboring block adjacent to the current block, a block vector in an LCU of the current block, a block vector in an LCU row / column of the current block, and the like.
[0260] The apparatus for encoding a video may encode a block vector without performing predictive encoding of the block vector. In this case, the apparatus for decoding a video may obtain the block vector by decoding the block vector information transmitted by a bit stream signal. Correction processing may be performed on the prediction / reconstructed sample generated by the intra-block copy method. In this case, the reference may be applied similarly / similarly. Figures 6 to 21 The correction method described herein is not described, and therefore a detailed description thereof will be omitted.
[0261] A device for encoding a video can generate a bitstream by binarizing symbols (e.g., transform coefficients, motion vector differences, syntax in slices, etc.) and performing arithmetic coding on binary values. Here, in order to compress symbols, the following items can be considered to determine the context: the value of the same symbol of adjacent blocks, information about adjacent blocks, the position of the current block, etc. When a probability index is determined based on the selected context, the probability of occurrence of the symbol can be determined based on the determined probability index. Next, the compression performance of the symbol can be improved by the following items: cumulative statistics of internal symbols, probability of occurrence recalculated based on the value of the encoded symbol, and arithmetic coding. As an example of an arithmetic coding method, CABAC can be used.
[0262] Will refer to Fig.23 An example of encoding a symbol in a device for encoding a video is described in detail. A detailed description of decoding a symbol in a device for decoding a video is omitted, but the decoding of the symbol can be performed by the device for decoding a video through the inverse process of the following embodiment.
[0263] Fig.23 is a flow chart showing the process of programming a symbol.
[0264] At step S2300, the apparatus for encoding the video may binarize the symbol. When the encoding target symbol is not a binary symbol, the apparatus for encoding the video may convert the symbol into a binary symbol. For example, the apparatus for encoding the video may binarize non-binary symbols (e.g., transform coefficients, motion vector differences), etc. into binary symbols consisting of values 0 and 1. When the symbol is binarized, in the mapped codeword, a bit with "0" or "1" may be referred to as a binary bit (bin).
[0265] The symbol binarization may be performed by unary binarization, truncated unary binarization, or the like.
[0266] Table 3 shows the unary binarization method, and Table 4 shows the truncated unary binarization method when the maximum bit length (cMax) is 6.
[0267] [Table 3]
[0268] symbol Binarization 0 0 1 10 2 110 3 1110 … ...
[0269] [Table 4]
[0270]
[0271]
[0272] When the symbol binarization is completed, a context model is selected at step S2310. The context model represents a probability model for each symbol. For each context model, the probability of occurrence of 0 or 1 in a binary bit (bin) may be different. In the following embodiments, the probability of occurrence of a symbol may indicate the probability of occurrence of 0 or 1 in a binary bit. In HEVC, there are approximately 400 independent contexts for various symbols.
[0273] When encoding of a slice begins, a probability index (pStateIdx) for each context may be initialized based on at least one of a quantization parameter (Qp) and a slice type (I, P, or B).
[0274] In the case of using blocks, when encoding of the block begins, the probability index of each context may be initialized based on at least one of a quantization parameter (Qp) and a slice type (I, P, or B).
[0275] Next, based on the selected context model, arithmetic coding for each symbol can be performed at step S2320. Arithmetic coding of symbols can be performed for each context model. Therefore, even if the symbols are the same, when different contexts are used, the probability update and bitstream encoding will not be affected. When the probability of occurrence of a symbol is determined, encoding can be performed according to the probability of occurrence of the symbol and the value of each symbol. Here, the number of coded bits can be determined differently according to the value of each symbol. That is, when the value of each symbol has a high probability of occurrence, the symbol can be compressed into a small number of bits. For example, when the value of each symbol has a high probability of occurrence, a symbol with ten binary bits can be encoded as less than ten bits.
[0276] The interval between [0,1) is divided into subintervals based on the probability of occurrence of the symbol, and among the real numbers belonging to the divided subintervals, a number and its coefficient that can be represented by the minimum number of bits are selected, thereby encoding the symbol. When the interval between [0,1) is divided into subintervals, when the probability of occurrence of the symbol is large, a long subinterval can be allocated, and when the probability of occurrence of the symbol is small, a small subinterval can be allocated.
[0277] Fig.24 1 is a view showing an example of dividing an interval between [0, 1) into subintervals based on the occurrence probability of symbols. Arithmetic encoding of a symbol "010" when the occurrence probability of 1 is 0.2 and the occurrence probability of 0 is 0.8 will be described.
[0278] Since the first binary bit of the symbol "010" is "0" and the occurrence probability of "0" is 0.8, the interval [0, 1) can be updated to [0, 0.8).
[0279] Since the second binary bit of the symbol "010" is "1" and the occurrence probability of "1" is 0.2, the interval [0, 0.8) can be updated to [0.64, 0.8).
[0280] Since the third binary bit of the symbol "010" is "0" and the occurrence probability of "0" is 0.8, the interval [0.64, 0.8) can be updated to [0.64, 0.768).
[0281] In the interval [0.64, 0.768), a number that can be represented by the least number of bits is selected. In the interval [0.64, 0.768), 0.75 = 1 × (1 / 2) + 1 × (1.2) ^ 2, so that the symbol "010" can be encoded as a binary "11" that does not include 0.
[0282] The most probable symbol (MPS) means a symbol with a high occurrence frequency between 0 and 1, and the least probable symbol (LPS) means a symbol with a low occurrence frequency between 0 and 1. The occurrence probability initial values of the MPS and LPS may be determined based on the context and the quantization parameter (Qp) value.
[0283] exist Fig.24 In the above, for each binary bit, it is assumed that the occurrence probabilities of 0 and 1 are fixed, but the MPS occurrence probability and LPS occurrence probability of the symbol can be updated according to whether the current encoded binary bit is MPS or LPS.
[0284] For example, when the binarization value of the binary bit of the symbol to be encoded currently is equal to the MPS, the MPS probability value of the symbol can be increased, while the LPS probability value can be decreased. Conversely, when the binarization value of the binary bit of the symbol to be encoded currently is equal to the LPS, the MPS probability value of the symbol can be decreased, while the LPS probability value can be increased.
[0285] In CABAC, 64 MPS occurrence probabilities and LPS occurrence probabilities are defined, but a smaller number or a larger number of MPS occurrence probabilities or LPS occurrence probabilities may be defined and used. The MPS occurrence probability and LPS occurrence probability may be specified by an index (pStateIdx) indicating the occurrence probability of a symbol. When the value of the index indicating the occurrence probability of a symbol is larger, the occurrence probability of the MPS is higher.
[0286] Table 5 is intended to illustrate an example of updating the probability index (pStateIdx).
[0287] [Table 5]
[0288]
[0289]
[0290] When MPS is encoded, the probability index (pStateIdx) indicating the probability value of the current context may be updated to an index corresponding to transIdxMPS. For example, when the value of pStateIdx is 16 and MPS is encoded, pStateIdx may be updated to an index 17 corresponding to transIdxMPS. Conversely, when the value of pStateIdx is 16 and LPS is encoded, pStateIdx may be updated to an index 13 corresponding to transIdxMPS. When pStateIdx is updated, the occurrence probabilities of MPS and LPS may be updated.
[0291] When the value of pStateIdx is 0, the occurrence probability of MPS is 0.5. In this state, when LPS is encoded, the frequency of LPS can be increased compared to MPS. Therefore, when the value of pStateIdx is 0 and LPS is encoded, MPS and LPS can be interchanged with each other.
[0292] The value of the probability index of each context can be initialized in units of slices or blocks. Since the probability index is initialized in units of slices, the current slice can be decoded regardless of whether the previous slice or the previous frame is encoded. However, when a symbol is encoded using the initialized probability index, the probability specified by the initialized probability index cannot correctly reflect the actual occurrence probability of the symbol, and thus the initial encoding efficiency of the slice may be reduced.
[0293] To solve this problem, the probability index accumulated at a predetermined point during encoding / decoding of the previous slice may be set as the initial value of the probability index of the current slice. Here, the predetermined point may indicate a start point for encoding / decoding a block located at a specific position (e.g., a middle position) in the slice in the scanning order. The probability value or probability index accumulated in the previous slice may be directly encoded / decoded through the current slice header or the like.
[0294] As another example, multiple probability indices may be assigned to one context so as to determine the initial probability index of the slice differently. For example, when there are multiple probability indices with different values for any context (ctx), one of the multiple probability indices may be determined as the initial probability index. Here, information for selecting one of the multiple probability indices may be transmitted by a signal through a slice header or the like. For example, a device for decoding a video may select a probability index through information transmitted from a slice header, and may perform decoding using the selected probability index as the initial probability index.
[0295] As another example, multiple initial values (InitValue) may be assigned to a context in order to determine the initial probability index of the slice differently. When the initial value is selected, the initial value may be used to obtain variables m and n, and the variable preCtxState indicating the previous context condition may be obtained by the obtained variables m and n. Based on the variable preCtxState indicating the previous context condition, the MPS and the context probability index initial value pStateIdx may be obtained.
[0296] Table 7 shows the process of obtaining the probability index based on the initial value.
[0297] [Table 7]
[0298]
[0299] An index for specifying an initial value (InitValue) to be used in a slice may be signaled through a slice header. An index for specifying a context initial value may be defined as a CABAC initialization index (cabac_init_idx). Based on a table defining a mapping relationship between at least two indexes selected from a group of CABAC initialization indexes, context indexes (ctxIdx), and initial values, an initial value corresponding to cabac_init_idx may be determined.
[0300] Furthermore, a syntax indicating the number of available CABAC initialization indexes may be signaled through a slice header, a sequence header, a picture header, etc. The syntax indicating the number of available CABAC initialization indexes may be defined as 'num_cabac_init_idx_minus1'.
[0301] Tables 8 and 9 are diagrams illustrating an example of determining an initial value based on a CABAC initialization index. Table 8 shows a case where the number of available CABAC initialization indexes is five, and Table 9 shows a case where the number of available CABAC initialization indexes is six. Table 8 or Table 9 may be selectively used based on the value of num_cabac_init_idx_minus1.
[0302] [Table 8]
[0303]
[0304] [Table 9]
[0305]
[0306] As an example, describing the syntax "cbf_luma", the context of the syntax cbf_luma indicating whether there is a non-zero transform coefficient in the transform block of the luma component may have different initial values according to cabac_init_idx. The probability index (pStateIdx) derived based on the initial value may also be determined differently according to cabac_init_idx.
[0307] cabac_init_idx may indicate an offset to be applied to the probability index. For example, the probability index (pStateIdx) may be obtained based on the quantization parameter (Qp) "sliceQpY" of any slice and the initial value (InitValue) determined for each context, and the offset to be applied to the probability index may be determined based on the value of cabac_init_idx. When the offset is determined, the probability index may be recalculated based on the probability index and the offset. Therefore, even when the quantization parameter (Qp) of the slice is the same, the context model may have multiple probability indexes (i.e., multiple pStateIdx initial values).
[0308] As another example, an initial value may be determined for each context, and an offset to be applied to the initial value may be determined based on the value of cabac_init_idx. The initial value may be recalculated based on the determined offset, and a probability index may be obtained based on the recalculated initial value.
[0309] In certain symbols but not all symbols, there are multiple probability indices for one context. For example, in certain symbols (e.g., transform coefficients, residual motion vectors (motion vector differences), reference picture indexes (reference indexes), etc.), there may be multiple probability indices for one context.
[0310] Whether to apply multiple initial values (InitValue) or multiple probability indexes (pStateIdx) to one context may be determined based on the slice type or may be determined regardless of the slice type. In addition, the initial value may be different for each slice type.
[0311] Fig.25 is a view showing an example of setting a probability index according to the position of a block to be encoded.
[0312] The probability index can be determined based on the spatial position or scanning order of the block to be encoded. Fig.25 As shown in the example in , different probability indexes (pStateIdx) can be set according to the scanning order in the slice. Here, the value of the probability index (pStateIdx) can be selected to be the same as or similar to the value of the probability index (prevPStateIdx) of the parallel region in the previous slice.
[0313] The spatial region for initializing the probability index may be referred to as a "context initialization region". The context initialization region may be set to a rectangular shape, but is not limited thereto. In addition, the context initialization region may be set to have a preset size, but is not limited thereto. Information for specifying the context initialization region may be transmitted by a signal through a slice header or the like.
[0314] Assuming that the context initialization region is a rectangular shape, the unit in which the probability index is initialized can be determined based on the syntax "num_row_ctu_minus1" indicating the number of rows of the coding tree unit included in the context initialization region. For example, when the value of "num_row_ctu_minus1" is one, as Fig.25 As shown in the example in , a region including two columns of CTUs can be set as an initialization region.
[0315] A slice is a default unit that can perform entropy encoding / decoding independently. A slice is not necessarily set to a rectangular shape. A slice can be divided into multiple segments, and a segment can be composed of multiple coding tree units (CTUs).
[0316] The block is similar to the slice in that the block is composed of multiple coding tree units like the slice, but the difference is that the block is set in a rectangular shape. Entropy encoding / decoding can be performed in units of blocks. When entropy encoding / decoding is performed in units of blocks, there is an advantage of parallelization that encoding / decoding can be performed on multiple blocks at the same time.
[0317] Fig.26 and Fig. 27 is a diagram showing an example of dividing blocks and segments.
[0318] like Fig.26 and Fig. 27 As shown in the example in , a block may include at least one fragment, and one fragment may exist in one block.
[0319] An independent segment and at least one dependent segment form a segment. Fig.26 and Fig. 27 As shown in the example in , a block does not necessarily include independent fragments.
[0320] Not shown in the figure, there may be a plurality of blocks in a slice, or there may be one block in one slice.
[0321] Fig.28 is a view showing an example of differently determining an initial probability index for each block.
[0322] When using blocks, the context model is initialized in units of blocks. Different initial values (InitValue) or different probability indexes (pStateIdx) can be used depending on the position of the block. That is, even if the context is the same, different probability indexes (pStateIdx) can be used depending on the block.
[0323] An index for specifying the initial value of each tile may be signaled through a slice header, etc. For example, when the initial value is specified by syntax "tile_cabac_init_idx" for specifying the initial value of a tile, a probability index may be obtained based on the specified initial value.
[0324] The probability index of each context of each block may be obtained based on an initial value or a probability index corresponding to a context of a parallel block of a previous frame. As another example, the probability index of each context of each block may be obtained based on an initial value selected from a plurality of initial values defined for the corresponding context, or may be determined as a probability index selected from a plurality of probability indices defined for the corresponding context. When a plurality of initial values or a plurality of probability indices are defined for the corresponding context, an index for selecting the initial value or probability index for each block may be transmitted by a signal.
[0325] exist Fig.28 In the example shown in , for symbols related to residual motion information (motion vector difference), in the first tile (tile0), the initial probability index is determined as pStateIdx0, and in the second tile (tile1), the initial probability index is determined as pStateIdx1.
[0326] The present disclosure may also have the following configurations:
[0327] 1. A method for decoding a video, the method comprising:
[0328] generating a first prediction sample by performing intra prediction on the current block;
[0329] Determining an intra-prediction mode that specifies a mode in which the current block is divided into sub-blocks;
[0330] Determine an offset in a sub-block unit of the current block based on the intra prediction mode; and
[0331] A second prediction sample is generated in a sub-block unit of the current block by using the first prediction sample and the offset.
[0332] 2. The method according to claim 1, wherein the current block includes a plurality of sub-blocks, and
[0333] It is determined whether to set the offset for each sub-block.
[0334] 3. The method according to scheme 2, wherein whether to set the offset for the sub-block is determined based on the position of the sub-block.
[0335] 4. The method according to claim 1, wherein the current block includes a plurality of sub-blocks, and
[0336] The offset is set to a different value for each sub-block.
[0337] 5. The method according to scheme 1, wherein the offset is obtained according to a reference sample adjacent to the current block.
[0338] 6. A device for decoding a video, the device comprising:
[0339] A prediction module generates a first prediction sample by performing intra-frame prediction on a current block, determines an intra-frame prediction mode that specifies a mode in which the current block is divided into sub-blocks, determines an offset in a sub-block unit of the current block based on the intra-frame prediction mode, and generates a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0340] 7. The device according to scheme 6, wherein the current block includes a plurality of sub-blocks, and
[0341] The prediction module determines whether to set the offset for each sub-block.
[0342] 8. The device according to scheme 7, wherein the prediction module determines whether to set the offset for the sub-block based on the position of the sub-block.
[0343] 9. The device according to scheme 6, wherein the current block includes a plurality of sub-blocks, and
[0344] The prediction module sets the offset to a different value for each sub-block.
[0345] 10. The device according to scheme 6, wherein the prediction module obtains the offset according to reference samples adjacent to the current block.
[0346] 11. A method for encoding a video, the method comprising:
[0347] generating a first prediction sample by performing intra prediction on the current block;
[0348] Determining an intra-prediction mode that specifies a mode in which the current block is divided into sub-blocks;
[0349] Determine an offset in a sub-block unit of the current block based on the intra prediction mode; and
[0350] A second prediction sample is generated in a sub-block unit of the current block by using the first prediction sample and the offset.
[0351] 12. The method according to claim 11, wherein the current block includes a plurality of sub-blocks, and
[0352] It is determined whether to set the offset for each sub-block.
[0353] 13. The method according to scheme 12, wherein whether to set the offset for the sub-block is determined based on the position of the sub-block.
[0354] 14. The method according to claim 11, wherein the current block includes a plurality of sub-blocks, and
[0355] The offset is set to a different value for each sub-block.
[0356] 15. A device for encoding a video, the device comprising:
[0357] A prediction module generates a first prediction sample by performing intra-frame prediction on a current block, determines an intra-frame prediction mode that specifies a mode in which the current block is divided into sub-blocks, determines an offset in a sub-block unit of the current block based on the intra-frame prediction mode, and generates a second prediction sample in a sub-block unit of the current block by using the first prediction sample and the offset.
[0358] Industrial Applicability
[0359] The present invention can be used for encoding / decoding video signals.
Claims
1. A method for decoding an image, comprising: Obtain residual coefficients of a current block in the image from a bitstream; Obtaining residual samples of the current block by performing inverse quantization and inverse transformation on residual coefficients of the current block; Performing intra prediction on the current block to generate a first prediction sample of the current block; obtaining a final prediction sample of the current block by modifying a first prediction sample of the current block using a second prediction sample also included in the current block; as well as reconstructing the current block based on the residual samples and the final prediction samples, wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and applying a second weight to the second prediction sample, The first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is encoded by intra-frame mode, and The first weight applied to the first prediction sample is greater when the neighboring block is encoded in intra mode than when the neighboring block is not encoded in intra mode.
2. The method according to claim 1, wherein: Depending on whether the neighboring block is encoded in intra mode or inter mode, when the neighboring block is encoded in intra mode, the set of the first weight and the second weight is determined to be {1 / 2, 1 / 2}, and when the neighboring block is not encoded in intra mode, the set of the first weight and the second weight is determined to be {3 / 4, 1 / 4}.
3. The method according to claim 2, wherein: generating a first prediction sample of the current block based on one of the intra prediction modes predefined in the decoding device, and The intra-frame prediction modes include a planar mode, a DC mode and a directional mode.
4. The method according to claim 3, wherein: The neighboring block includes at least one of an upper neighboring block or a left neighboring block.
5. A method for encoding an image, comprising: Performing intra prediction on a current block to generate a first prediction sample of the current block; obtaining a final prediction sample of the current block by modifying a first prediction sample of the current block using a second prediction sample also included in the current block; obtaining residual samples of the current block in the image based on differences between original samples and the final predicted samples corresponding to the residual samples of the current block; Performing transformation and quantization on the residual samples of the current block to generate residual coefficients of the current block; as well as Generate a bitstream by encoding residual coefficients of the current block, wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and a second weight to the second prediction sample, The first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is encoded by intra-frame mode, and The first weight applied to the first prediction sample is greater when the neighboring block is encoded in intra mode than when the neighboring block is not encoded in intra mode.
6. A device for transmitting a bit stream, the device comprising: A processor that obtains a bitstream; as well as A transmission unit that transmits a bit stream. Wherein, obtaining the bit stream includes: Performing intra prediction on a current block to generate a first prediction sample of the current block; obtaining a final prediction sample of the current block by modifying a first prediction sample of the current block using a second prediction sample also included in the current block; obtaining residual samples of the current block in the image based on differences between original samples and the final predicted samples corresponding to the residual samples of the current block; performing transformation and quantization on the residual samples of the current block to generate residual coefficients of the current block; and Generate a bitstream by encoding residual coefficients of the current block, wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and a second weight to the second prediction sample, The first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is encoded by intra-frame mode, and The first weight applied to the first prediction sample is greater when the neighboring block is encoded in intra mode than when the neighboring block is not encoded in intra mode.
Citation Information
Patent Citations
Methods and apparatus for illumination compensation of intra-predicted video
CN101911708A
Offset decoding device, offset coding device, image filtering device, and data structure
US20140140416A1
