Method for decoding and encoding video and device for transmitting bit stream

By adaptively selecting the transformation type and processing the encoding block of the video signal, the problem of low encoding/decoding efficiency of high-resolution video signals is solved, and more efficient encoding and storage is achieved.

CN114598865BActive Publication Date: 2024-12-24KT CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210310334.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2016-03-28
Filing Date
2017-03-28
Publication Date
2024-12-24
Estimated Expiration
2037-03-28

AI Technical Summary

Technical Problem

The prior art, when processing high resolution and high quality video signals, has low encoding/decoding efficiency and is difficult to effectively classify and adaptively process encoding blocks, resulting in increased transmission and storage costs.

Method used

By determining multiple transform type candidate sets, the transformation type of the current block is adaptively selected, and inverse transformation and quantization processing is performed according to the characteristics of the encoding/decoding target block, thereby improving the encoding/decoding efficiency.

Benefits of technology

It improves the encoding/decoding efficiency of video signals, reduces transmission and storage costs, and optimizes the processing according to the characteristics of different encoding blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114598865B_ABST
    Figure CN114598865B_ABST
Patent Text Reader

Abstract

Disclosed are a method for decoding and encoding a video and a decoding device. The method for decoding a video includes: determining whether to skip inverse transform for a current block based on a transform skip flag, the transform skip flag indicating whether to skip inverse transform; when it is determined that inverse transform is not skipped for the current block, determining a transform core of the current block; and performing inverse transform on the current block based on the determined transform core, wherein determining the transform core of the current block includes: determining one of a plurality of transform core sets based on information decoded from a bitstream, and determining the transform core of the current block based on one of a plurality of transform core sets, wherein each of the plurality of transform core sets includes a first transform core and a second transform core, each of the first transform core and the second transform core is one of DCT-VIII and DST-VII, and wherein, when the current block is one of the partitions generated by partitioning the coding block based on a horizontal partition type or a vertical partition type, it is forced not to skip inverse transform for the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the Chinese patent application with the application date of March 28, 2017, the international application number of PCT / KR2017 / 003357, the invention name of “Method and device for processing video signals”, and the application number of 201780020638.3 that has entered the Chinese national phase. Technical Field

[0002] The present invention relates to a method and an apparatus for processing a video signal. Background Art

[0003] Recently, the demand for high-resolution and high-quality images (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 has increased 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 cost of transmission and storage increases. In order to solve these problems arising as the resolution and quality of image data are improved, efficient image encoding / decoding technology can be used.

[0004] Image compression technology includes various technologies, including: inter-frame prediction technology for predicting pixel values ​​included in a current picture based on a previous picture or a subsequent picture of the current picture; intra-frame prediction technology for predicting pixel values ​​included in a current picture by using pixel information in the current picture; entropy coding technology for assigning short codes to values ​​with high frequency of occurrence and assigning long codes to values ​​with low frequency of occurrence, etc. Image data can be effectively compressed by using such image compression technology, and the image data can be transmitted or stored.

[0005] Meanwhile, as the demand for high-resolution images increases, the demand for stereoscopic image content as a new image service is also increasing. Video compression technology for efficiently providing stereoscopic image content with high resolution and ultra-high resolution is being explored. Summary of the invention

[0006] Technical issues

[0007] The object of the present invention is to provide a method and an apparatus for hierarchically dividing coding blocks when encoding / decoding a video signal.

[0008] An object of the present invention is to provide a method and apparatus for selectively performing inverse transformation on a target block for encoding / decoding when encoding / decoding a video signal.

[0009] An object of the present invention is to provide a method and apparatus for adaptively determining a transform type according to a coding / decoding target block when inverse transforming the coding / decoding target block.

[0010] The object of the present invention is to provide a method and apparatus for obtaining a quantization parameter residual value according to characteristics of a coding / decoding target block when encoding / decoding a video signal.

[0011] The technical objectives to be achieved by the present invention are not limited to the above-mentioned technical problems. Moreover, those skilled in the art will clearly understand other technical problems not mentioned from the following description.

[0012] Technical Solution

[0013] According to the method and apparatus for decoding a video signal of the present invention, a transform set including multiple transform type candidates for a current block can be determined, a transform type of the current block can be determined from the multiple transform type candidates, and an inverse transform can be performed on the current block based on the transform type of the current block.

[0014] In the method and apparatus for decoding a video signal according to the present invention, a transform type of a current block may be adaptively selected from a plurality of transform type candidates according to whether the current block satisfies a predetermined condition.

[0015] In the method and apparatus for decoding a video signal according to the present invention, the predetermined condition may be adaptively determined according to the size of the current block.

[0016] In the method and apparatus for decoding a video signal according to the present invention, inverse transform may include horizontal direction transform and vertical direction transform for the current block, and the transform set may include a first transform set for horizontal direction transform and a second transform set for vertical direction transform.

[0017] In the method and apparatus for decoding a video signal according to the present invention, the transform set may be specified by index information obtained from a bitstream.

[0018] In the method and apparatus for decoding a video signal according to the present invention, the transform set may be determined based on a transform set of a block having a prediction mode identical to or similar to the current block among blocks decoded before the current block.

[0019] In the method and apparatus for decoding a video signal according to the present invention, the method and apparatus may decode information indicating whether to skip inverse transformation for a current block, and determine whether to perform inverse transformation for the current block based on the information.

[0020] In the method and apparatus for decoding a video signal according to the present invention, the information may include information indicating whether to skip horizontal direction inverse transformation of the current block and information indicating whether to skip vertical direction inverse transformation of the current block.

[0021] In the method and apparatus for decoding a video signal according to the present invention, when information indicates to skip inverse transform for the current block, at least one of horizontal direction transform or vertical direction transform may be skipped according to the shape of the current block.

[0022] According to the method and apparatus for encoding a video signal of the present invention, a transform set including multiple transform type candidates for a current block can be determined, a transform type of the current block can be determined from the multiple transform type candidates, and a transform can be performed on the current block based on the transform type of the current block.

[0023] In a method and apparatus for encoding a video signal according to the present invention, the method and apparatus may determine a quantization parameter residual value for a current block, determine a quantization parameter for the current block based on the quantization parameter residual value, and perform quantization on the current block based on the quantization parameter.

[0024] In the method and apparatus for encoding a video signal according to the present invention, a quantization parameter residual value may be determined based on an average value related to a current block, and the average value may be determined based on a DC coefficient generated as a result of transformation and a prediction signal of the current block.

[0025] In the method and apparatus for encoding a video signal according to the present invention, a quantization parameter residual value can be determined by referring to a lookup table defining a mapping relationship between an average value and a quantization parameter residual value, and the lookup table can be determined based on at least one of a size of a current block, an intra-prediction mode, a transform type, or a pixel value.

[0026] According to the present invention, the method for decoding a video includes: determining whether to skip inverse transform for a current block based on a transform skip flag, the transform skip flag indicating whether to skip the inverse transform; when it is determined that the inverse transform is not skipped for the current block, determining the transform core of the current block; and performing the inverse transform on the current block based on the determined transform core, wherein determining the transform core of the current block includes: determining one of a plurality of transform core sets based on information decoded from a bitstream, and determining the transform core of the current block based on one of the plurality of transform core sets, wherein each of the plurality of transform core sets includes a first transform core and a second transform core, each of the first transform core and the second transform core is one of DCT-VIII and DST-VII, and wherein, when the current block is one of the partitions generated by partitioning the coding block based on a horizontal partition type or a vertical partition type, it is forced not to skip the inverse transform for the current block.

[0027] According to the present invention, the method for encoding a video includes: determining whether to skip the transformation for the current block; when it is determined that the transformation is not skipped for the current block, determining the transformation core of the current block; and performing the transformation on the current block based on the transformation core, wherein the transformation core of the current block is determined based on one of a plurality of transformation core sets, and information for specifying one of the plurality of transformation core sets is encoded into a bit stream, wherein each of the plurality of transformation core sets is configured with a first transformation core and a second transformation core, each of the first transformation core and the second transformation core is one of DCT-VIII and DST-VII, and wherein, when the current block is one of the partitions generated by partitioning the coding block based on a horizontal partition type or a vertical partition type, it is forced not to skip the transformation for the current block.

[0028] According to the present invention, an apparatus for decoding a bitstream associated with a video signal, wherein the bitstream includes residual coefficients generated by encoding residual values ​​of a current block, wherein the residual values ​​are reconstructed by performing inverse quantization and inverse transformation on the residual coefficients, wherein the inverse transformation is selectively performed based on a transform skip flag indicating whether to skip the inverse transformation, wherein a transform kernel for the inverse transformation of the current block is determined based on one of a plurality of transform kernel sets, wherein one of the plurality of transform kernel sets is determined based on information included in the bitstream, wherein each of the plurality of transform kernel sets includes a first transform kernel and a second transform kernel, each of the first transform kernel and the second transform kernel being one of DCT-VIII and DST-VII, and wherein, when the current block is one of partitions generated by partitioning a coding block based on a horizontal partition type or a vertical partition type, the inverse transformation is forced not to be skipped for the current block.

[0029] The features of the above brief summary of the present invention are merely illustrative aspects of the detailed description of the invention that follows and do not limit the scope of the invention.

[0030] Beneficial Effects

[0031] According to the present invention, the encoding / decoding efficiency can be improved through hierarchical / adaptive division of coding blocks.

[0032] According to the present invention, encoding / decoding efficiency can be improved by selectively performing inverse transform for encoding / decoding target blocks.

[0033] According to the present invention, encoding / decoding efficiency can be improved by adaptively determining a transform type for encoding / decoding a target block.

[0034] According to the present invention, encoding / decoding efficiency can be improved by obtaining a quantized residual value according to characteristics of an encoding / decoding target block.

[0035] Effects obtainable by the present invention are not limited to the above-mentioned effects, and other effects not mentioned can be clearly understood by those skilled in the art from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.

[0037] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.

[0038] 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.

[0039] 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.

[0040] Figure 5 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.

[0041] 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.

[0042] 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.

[0043] Fig. 9 is a view illustrating a method of correcting a prediction sample based on an offset according to an embodiment of the present invention.

[0044] Figures 10 to 14 is a view showing an example of an intra prediction method of a current block according to an embodiment of the present invention.

[0045] Fig.15 is a view illustrating a method of performing prediction using an intra block copy technique according to an embodiment of the present invention.

[0046] Fig.16 A range of reference samples used for intra prediction according to an embodiment to which the present invention is applied is shown.

[0047] Figures 17 to 19 An example of filtering reference samples is shown.

[0048] Fig. 20 is a diagram illustrating an example of dividing a coding unit into blocks having a square shape.

[0049] Fig.21 is a diagram illustrating an example of dividing a coding unit into blocks having a non-square shape.

[0050] Fig. 22 is a flow chart illustrating a process of performing an inverse transform for a current block.

[0051] Fig.23 An example of determining a transform set of a transform unit based on an intra prediction mode of a prediction unit is shown.

[0052] Fig.24 is a flowchart illustrating a method for obtaining a quantization parameter difference value according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] Various modifications can be made to the present invention, 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.

[0054] 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.

[0055] 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.

[0056] The terms used in this specification are only used to describe specific embodiments and are not intended to limit the present invention. Expressions used in the singular include expressions in the plural form unless the expression has a significantly different meaning in the context. In this specification, it should be understood that terms such as "including", "having" 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.

[0057] Hereinafter, preferred embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. Hereinafter, the same constituent elements in the drawings are denoted by the same reference numerals, and repeated description of the same elements will be omitted.

[0058] Figure 1 is a block diagram illustrating an apparatus for encoding a video according to an embodiment of the present invention.

[0059] Reference Figure 1 , the device 100 for encoding a video may include: a picture division module 110, prediction modules 120 and 125, a transformation module 130, a quantization module 135, a rearrangement module 160, an entropy coding module 165, an inverse quantization module 140, an inverse transformation module 145, a filter module 150 and a memory 155.

[0060] Figure 1The components shown are shown independently to represent the characteristic functions that are different from each other in the device for encoding the video. Therefore, it does not mean that each component is composed of separate hardware or software components. In other words, for convenience, each component includes each of the listed components. Therefore, at least two components 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.

[0061] In addition, some of the components may not be indispensable components for performing the basic functions of the present invention, but optional components only for improving the performance of the present invention. The present invention can be realized by excluding components for improving performance and only including indispensable components for realizing the essence of the present invention. Structures excluding optional components only for improving performance and only including indispensable components are also included in the scope of the present invention.

[0062] The picture partitioning module 110 may partition an input picture into one or more processing units. Here, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture partitioning module 110 may partition a picture into a combination of a plurality of coding units, prediction units, and transform units, and may encode a picture by selecting a combination of coding units, prediction units, and transform units using a predetermined criterion (e.g., a cost function).

[0063] For example, a picture can be divided into multiple coding units. A recursive tree structure (e.g., a quadtree structure) can be used to divide a picture into coding units. Coding units divided into other coding units with a picture or a maximum coding unit as the root can be divided in a manner that the child nodes correspond to the number of divided coding units. Coding units that cannot be further divided according to predetermined restrictions are used as leaf nodes. That is, when it is assumed that only square division is feasible for a coding unit, a coding unit can be divided into up to four other coding units.

[0064] Hereinafter, in an embodiment of the present invention, a coding unit may mean a unit that performs encoding or a unit that performs decoding.

[0065] The prediction unit may be one of partitions split into square shapes or rectangular shapes having the same size in a single coding unit, or the prediction unit may be one of partitions split into different shapes / sizes in a single coding unit.

[0066] 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.

[0067] 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, it may be transmitted to a device for decoding a video by encoding the original block as it is, without generating a prediction block by the prediction modules 120 and 125.

[0068] The inter-frame prediction module 120 may predict a prediction unit based on information of at least one of a previous picture or a subsequent picture of the current picture, or in some cases, may predict a prediction unit based on information of some coding regions in the current picture. The inter-frame prediction module 120 may include a reference picture interpolation module, a motion prediction module, and a motion compensation module.

[0069] The reference picture interpolation module may receive reference picture information from the memory 155, and may generate pixel information of integer pixels or less than integer pixels according to the reference picture. In the case of luma pixels, an 8-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 4 pixels. In the case of chrominance signals, a 4-tap interpolation filter based on DCT with different filter coefficients may be used to generate pixel information of integer pixels or less than integer pixels in units of 1 / 8 pixels.

[0070] The motion prediction module can perform motion prediction based on the reference picture interpolated by the reference picture interpolation module. As a method for calculating the motion vector, various methods such as a full search based block matching algorithm (FBMA), a three-step search (TSS), and a new three-step search algorithm (NTS) can be used. Based on the interpolated pixels, the motion vector can have a motion vector value in units of 1 / 2 pixel or 1 / 4 pixel. The motion prediction module can predict the current prediction unit by changing the motion prediction method. As a motion prediction method, various methods such as a skip method, a merge method, an AMVP (Advanced Motion Vector Prediction) method, an intra-frame block copy method, etc. can be used.

[0071] 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, the reference pixel information of the adjacent block to be intra-predicted may be used to replace the reference pixel of 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.

[0072] 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.

[0073] When performing intra prediction, when the size of the prediction unit is the same as that 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 that of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using N×N partitioning only for the minimum coding unit can be used.

[0074] In the intra prediction method, a prediction block may be generated after applying an AIS (Adaptive Intra Smoothing) filter to a reference pixel according to a prediction mode. The type of the AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted according to the intra prediction mode of a prediction unit adjacent to the current prediction unit. In the process of predicting the prediction mode of the current prediction unit by using the mode information predicted according to the adjacent prediction unit, when the intra prediction mode of the current prediction unit is the same as the intra prediction mode of the adjacent prediction unit, predetermined marking information may be used to transmit information indicating that the prediction mode of the current prediction unit and the prediction mode of the adjacent prediction unit are the same as each other. When the prediction mode of the current prediction unit is different from the prediction mode of the adjacent prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.

[0075] 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.

[0076] The transform module 130 may transform the residual block including information on the residual value between the original block and the prediction unit generated by the prediction modules 120 and 125 by using a transform method such as discrete cosine transform (DCT), discrete sine transform (DST), and KLT. Whether to apply DCT, DST, or KLT to transform the residual block may be determined based on intra prediction mode information of the prediction unit used to generate the residual block.

[0077] The quantization module 135 may quantize the value transformed to the frequency domain by the transform module 130. The quantization coefficient may vary according to the block or importance of the picture. The value calculated by the quantization unit 135 may be provided to the inverse quantization module 140 and the rearrangement module 160.

[0078] The rearrangement module 160 may rearrange coefficients of the quantized residual value.

[0079] The rearrangement module 160 can change the coefficient of the two-dimensional block form into the coefficient of the one-dimensional vector form by the coefficient scanning method. For example, the rearrangement module 160 can use 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.

[0080] The entropy encoding module 165 may perform entropy encoding based on the value calculated by the rearrangement module 160. The entropy encoding may use various encoding methods, for example, exponential Golomb coding, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC).

[0081] The entropy coding module 165 can encode various information from the rearrangement module 160 and the prediction modules 120 and 125 (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.).

[0082] The entropy encoding module 165 may entropy encode coefficients of the coding unit input from the rearrangement module 160 .

[0083] The inverse quantization module 140 may inversely quantize the value quantized by the quantization module 135, and the inverse transform module 145 may inversely transform the value transformed by the transform module 130. The residual values ​​generated by the inverse quantization module 140 and the inverse transform module 145 may be combined with the prediction units predicted by the motion estimation module, the motion compensation module, and the intra prediction module of the prediction modules 120 and 125, so that a reconstructed block may be generated.

[0084] The filter module 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).

[0085] The deblocking filter can remove block distortion that occurs due to the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, the pixels 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.

[0086] The offset correction module can correct the offset from the original picture in units of pixels for the picture to be deblocked. In order to perform offset correction on a specific picture, a method of applying an offset considering edge information of each pixel can be used, or the following method can be used: the pixels of the picture are divided into a predetermined number of regions, the region to be offset is determined, and the offset is applied to the determined region.

[0087] Adaptive loop filtering (ALF) can be performed based on a value obtained by comparing a filtered reconstructed picture with an original picture. The pixels included in the picture can be divided into predetermined groups, the filter to be applied to each group can be determined, and filtering can be performed separately for each group. Information on whether to apply ALF and a luminance signal can be transmitted by a coding unit (CU). The shape and filter coefficients of the filter used for ALF can be different for each block. In addition, regardless of the characteristics of the application target block, the filter for ALF of the same shape (fixed shape) can be applied.

[0088] The memory 155 may store a reconstructed block or a reconstructed picture calculated by the filter module 150. The stored reconstructed block or the reconstructed picture may be provided to the prediction modules 120 and 125 when performing inter prediction.

[0089] Figure 2 is a block diagram illustrating an apparatus for decoding a video according to an embodiment of the present invention.

[0090] Reference Figure 2 , the apparatus 200 for decoding a video may include: an entropy decoding module 210 , a rearrangement module 215 , an inverse quantization module 220 , an inverse transform module 225 , prediction modules 230 and 235 , a filter module 240 , and a memory 245 .

[0091] When a video bitstream is input from an apparatus for encoding a video, the input bitstream may be decoded according to an inverse process of the apparatus for encoding a video.

[0092] The entropy decoding module 210 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.

[0093] The entropy decoding module 210 may decode information about intra prediction and inter prediction performed by the apparatus for encoding a video.

[0094] The rearrangement module 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding module 210 based on the rearrangement method used in the apparatus for encoding the video. The rearrangement module may reconstruct and rearrange the coefficients in the form of a one-dimensional vector into coefficients in the form of a two-dimensional block. The rearrangement module 215 may perform rearrangement by receiving information related to coefficient scanning performed in the apparatus for encoding the video, and may perform rearrangement by inversely scanning the coefficients based on the scanning order performed in the apparatus for encoding the video.

[0095] 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.

[0096] The inverse transform module 225 may perform an inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, which is an inverse process of the transform performed by the transform module on the quantization result of the device for encoding the video, i.e., DCT, DST, and KLT. The inverse transform may be performed based on a transmission unit determined by the device for encoding the video. The inverse transform module 225 of the device for decoding the video may selectively perform a transform scheme (e.g., DCT, DST, KLT) according to a plurality of pieces of information (e.g., a prediction method, a size of a current block, a prediction direction, etc.).

[0097] The prediction modules 230 and 235 may generate a prediction block based on information on the prediction block generation received from the entropy decoding module 210 and picture information received from the memory 245 or a previously decoded block.

[0098] As described above, similar to the operation of the apparatus for encoding a video, when performing intra-frame prediction, when the size of the prediction unit is the same as the size of the transform unit, intra-frame prediction can be performed on the prediction unit based on pixels located on the left, upper left, and upper sides of the prediction unit. When performing intra-frame prediction, when the size of the prediction unit is different from the size of the transform unit, intra-frame prediction can be performed using reference pixels based on the transform unit. In addition, intra-frame prediction using N×N partitioning only for the minimum coding unit can be used.

[0099] The prediction modules 230 and 235 may include a prediction unit determination module, an inter-frame prediction module, and an intra-frame prediction module. The prediction unit determination module may receive various information (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.

[0100] 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.

[0101] The intra prediction module 235 can generate a prediction block based on pixel information in the current picture. When the prediction unit is a prediction unit 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 whether to apply the filter can be determined 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.

[0102] 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.

[0103] 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.

[0104] Information about whether to apply a deblocking filter to a corresponding block or picture and information about which filter of a strong filter and a weak filter to apply when applying the deblocking filter can be received from a device for encoding a video. 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.

[0105] The offset correction module may perform offset correction on the reconstructed picture based on the type of offset correction applied to the picture when encoding is performed and offset value information.

[0106] The 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.

[0107] 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.

[0108] As described above, in the embodiments of the present invention, for convenience of explanation, a coding unit is used as a term indicating a unit for encoding, however, the coding unit may be used as a unit that performs decoding as well as encoding.

[0109] Figure 3 is a view showing an example of hierarchically dividing a coding block based on a tree structure according to an embodiment of the present invention.

[0110] The input video signal is decoded in 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.

[0111] 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 can be a square block or a non-square block (e.g., a rectangular shape). Binary tree-based division can be performed on the coding block where quadtree-based division is no longer performed. Quadtree-based division may no longer be performed on the coding block based on binary tree division.

[0112] 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.

[0113] 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.

[0114] 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.

[0115] 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.

[0116] Meanwhile, the second coding block 310 may be determined as a leaf coding block 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.

[0117] 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.

[0118] 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 divided based on the binary tree. In this case, the coding block 310b-1 can be used as a prediction block or a transform block. However, the above-mentioned division 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.

[0119] 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.

[0120] 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.

[0121] 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.

[0122] 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.

[0123] 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.

[0124] 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, while for Intra_N×N, only 35 directional intra prediction modes may be allowed.

[0125] Figure 5 is a flowchart briefly illustrating an intra prediction method according to an embodiment of the present invention.

[0126] Reference Figure 5, the intra prediction mode of the current block may be determined at step S500.

[0127] 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 the 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 may specify one candidate among the multiple candidates in the candidate list. The candidate specified by the index may be set to the intra prediction mode of the current block.

[0128] 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, for example, one, two, or more.

[0129] The candidate list may further 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.

[0130] 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 determined differently 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 determine the maximum number of candidates that can be included in the candidate list differently. 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.

[0131] 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).

[0132] 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.

[0133] 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.

[0134] 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.

[0135] 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.

[0136] [Table 1]

[0137]

[0138] 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.

[0139] Reference Figure 5 , at step S510, a reference sample for intra prediction of the current block may be obtained.

[0140] 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.

[0141] 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.

[0142] 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.

[0143] [Table 2]

[0144] 8x8 Transform 16x16 Transform 32x32 Transform Threshold 7 1 0

[0145] 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 may be specified in a plurality of intra filter candidates. Alternatively, the intra filter may be determined based on at least one of the size / shape of the current block, the size / shape of the transform block, information on filter strength, and changes in neighboring samples.

[0146] Reference Figure 5 At step 520, intra prediction may be performed using the intra prediction mode and reference samples of the current block.

[0147] 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 may be used, and thus the quality of the predicted picture may be reduced. Therefore, a correction process may be performed on the prediction samples generated by the above prediction process, and the reference samples may be used as the reference samples. Figures 6 to 14 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.

[0148] 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.

[0149] 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 multiple rows / columns, or may be preset areas for correction in an apparatus for encoding / decoding a video, or may be determined differently based on at least one of a size / shape of the current block and an intra prediction mode.

[0150] 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 determined differently 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 different positions according to the positions of the prediction samples as the correction target.

[0151] The differential information of the adjacent samples may mean the differential samples between the adjacent samples, or may mean a value obtained by scaling the differential samples by a predetermined constant value (e.g., one, two, three, etc.). Here, the predetermined constant value may be determined in consideration of the 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.

[0152] For example, when the intra prediction mode of the current block is a vertical mode, as shown in Equation 1, the final prediction sample can be obtained using the differential sample between the upper left adjacent sample p (-1, -1) and the adjacent sample p (-1, y) adjacent to the left boundary of the current block.

[0153] [Equation 1]

[0154] P'(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1 where y=0...N-1

[0155] For example, when the intra prediction mode of the current block is a horizontal mode, as shown in Equation 2, the final prediction sample can be obtained using the differential sample between the upper left adjacent sample p(-1, -1) and the adjacent sample p(x, -1) adjacent to the upper boundary of the current block.

[0156] [Equation 2]

[0157] P′(x, 0)=p(x, 0)+((p(x, -1)-p(-1, -1))>>1 where x=0...N-1

[0158] 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 Equations 3 and 4.

[0159] [Equation 3]

[0160] P'(0,y)=P(0,y)+((p(-1,y)-p(-1,-1))>>1 where y=0...N-1

[0161] [Equation 4]

[0162] P'(1,y)=P(1,y)+((p(-1,y)-p(-1,-1))>>2 where y=0...N-1

[0163] 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 Equations 5 and 6.

[0164] [Equation 5]

[0165] P′(x, 0)=p(x, 0)+((p(x, -1)-p(-1, -1))>>1 where x=0...N-1

[0166] [Equation 6]

[0167] P′(x, 1)=p(x, 1)+((p(x, -1)-p(-1, -1))>>2 Where x=0...N-1

[0168] 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.

[0169] 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.

[0170] 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.

[0171] 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.

[0172] The filtering of the prediction samples may be performed only on the rows located at the block boundary, or may be performed on a plurality of 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.

[0173] 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. 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.

[0174] Depending on whether the adjacent blocks are encoded in inter-frame mode or intra-frame mode, different correction filters can be applied. When the adjacent blocks are encoded in intra-frame mode, a filtering method that gives more weight to the prediction samples can be used than when the adjacent blocks are encoded in inter-frame mode. For example, in the case where the intra-frame prediction mode is 34, when the adjacent blocks are encoded in inter-frame mode, a (1 / 2, 1 / 2) filter can be used, and when the adjacent blocks are encoded in intra-frame mode, a (4 / 16, 12 / 16) filter can be used.

[0175] The number of rows to be filtered in the current block may vary 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.

[0176] Figure 7 and Figure 8 Based on the use Figure 4 The present invention is not limited to the case of 35 intra-frame prediction modes in , but can also be equally / similarly applied to the case of using extended intra-frame prediction modes.

[0177] 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.

[0178] 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.

[0179] In order to solve the above problem, a method of generating or updating prediction samples in units of sub-blocks may be used, whereby the prediction accuracy in an area relatively far from a block boundary may be improved.

[0180] 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.

[0181] Will refer to Fig. 9 A method based on offset-corrected prediction samples is described in detail.

[0182] 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.

[0183] Reference Fig. 9 , for the current block, it may be determined at step S900 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 0, a method of updating the first prediction sample using an offset is not used in the current block. However, step S900 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 S900 may be omitted in some cases.

[0184] 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 S910. Through the intra prediction mode, all or some areas of the current block to which the offset is applied, the partition type 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.

[0185] 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 a 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 a directional intra prediction mode is used, an angle of a directional intra prediction mode, etc.

[0186] Whether to signal an index indicating an intra prediction mode of a current block is determined by predetermined flag information signaled via 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.

[0187] 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.

[0188] When the intra prediction mode of the current block is determined, the offset in the sub-block unit can be obtained at step S920. 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.

[0189] When the offset is determined, a second prediction sample may be obtained for each sub-block at step S930. 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 by subtracting the offset from the first prediction sample.

[0190] Figures 10 to 14 is a view showing an example of an intra prediction method of a current block according to an embodiment of the present invention.

[0191] For example, in Fig.10 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 in the upper sub-block as it is, 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 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.

[0192] When the index is "2" or "3", the current block is divided into a left subblock and a right subblock. No offset may be set for the left subblock, and an offset "f" may be set for the right subblock. Therefore, the first prediction sample (P(i, j)) can be used in the left subblock as it is, 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 can be used in the right subblock.

[0193] 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.

[0194] 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).

[0195] exist Fig.10 In the embodiment, an offset is not set for one of the subblocks included in the current block, but an offset is set for another subblock. Whether to set an offset for a subblock may be determined based on information transmitted with a signal for each subblock.

[0196] 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.

[0197] 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.

[0198] 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.

[0199] exist Fig.10 In the example, it is assumed that an offset is not set for one of the subblocks included in the current block, but an offset is set for another subblock. As another example, different offset values ​​may be set for the subblocks included in the current block.

[0200] Will refer to Fig.11 An example of setting a different offset for each sub-block is described below.

[0201] Reference Fig.11, 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) may be generated in the upper sub-block by adding an offset "h" to the first prediction sample or subtracting an offset "h" from the first prediction sample, and a second prediction sample (P(i,j)+f or P(i,j)-f) may be generated by adding an offset "f" to the first prediction sample or subtracting an offset "f" from the first prediction sample.

[0202] Reference Fig.11 , when the index is "2" or "3", the offset "h" may be set for the left subblock of the current block, and the offset "f" may be set for the right subblock of the current block. Therefore, the second prediction sample (P(i,j)+h or P(i,j)-h) may be generated in the left subblock by adding the offset "h" to the first prediction sample or subtracting the offset "h" from the first prediction sample, and the second prediction sample (P(i,j)+f or P(i,j)-f) may be generated in the right subblock by adding the offset "f" to the first prediction sample or subtracting the offset "f" from the first prediction sample.

[0203] exist Fig.10 and Fig.11 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.10 and Fig.11 The number of sub-blocks included in the current block may be three or more, and the sub-blocks may have different sizes.

[0204] 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.

[0205] Will refer to Fig.12 An example of determining an intra prediction method of a current block based on a first index and a second index is described below.

[0206] exist Fig.12 In the example shown, 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.

[0207] 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.12 In the example shown, the first index may specify one of categories 0, 1, and 2.

[0208] 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 category 1 is specified by the first index, the second index can specify one of the four intra prediction modes of category 1 (ie, index 4 to index 7).

[0209] exist Fig.12 In FIG. 1 , it is shown that the categories include the same number of intra prediction modes. However, the categories do not necessarily include the same number of intra prediction modes.

[0210] 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.

[0211] 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.13 In contrast, when the size of the current block (e.g., the coding unit of the current block) is smaller than 64×64, the intra-frame prediction mode of the current block can be selected from the five intra-frame prediction modes shown in FIG. Fig.10 , Fig.11 or Fig.12 Select the intra-frame prediction mode for the current block from the intra-frame prediction modes shown.

[0212] exist Figures 10 to 13 In FIG. 1 , it is depicted that the subblocks included in each intra prediction mode have a rectangular shape. As another example, an intra prediction mode may be used in which at least one of the size and shape of the subblocks is different from each other. For example, Fig.14 is a view showing an example of an intra prediction method for subblocks having different sizes and shapes.

[0213] The offset of each sub-block (e.g. Figures 10 to 14 The offset h, f, g or i) of each sub-block shown can be decoded from the bitstream or can be obtained from neighboring samples adjacent to the current block.

[0214] 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.

[0215] As another example, the offset of the sub-block 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 sub-block.

[0216] 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.

[0217] 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.

[0218] Fig.15 is a view illustrating a method of performing prediction using an intra block copy scheme according to an embodiment of the present invention.

[0219] 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"). If a picture contains a large number of characters (e.g., Korean letters, letters, etc.) and a character contained in the current block is contained in an already decoded block when reconstructing the current block, intra-block copying can improve encoding / decoding performance.

[0220] 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 have a different position in the reference picture list, and to this end, reference picture indexes indicating the position of the current picture may be transmitted by signaling, respectively.

[0221] 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).

[0222] 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.

[0223] 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.

[0224] 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 14 The correction method described herein is not described, and therefore a detailed description thereof will be omitted.

[0225] Fig.16 A range of reference samples used for intra prediction according to an embodiment to which the present invention is applied is shown.

[0226] Reference Fig.16 , intra prediction can be performed by using reference samples P(-1, -1), P(-1, y) (0<=y<=2N-1) and P(x, -1) (0<=x<=2N-1) located at the boundary of the current block. At this time, filtering of the reference samples is selectively performed based on at least one of the intra prediction mode of the current block (e.g., the index, directionality, angle, etc. of the intra prediction mode) or the size of the transform block related to the current block.

[0227] At least one of the plurality of intra-frame filter candidates may be selected to perform filtering on the reference sample. Here, the plurality of intra-frame filter candidates may differ from each other in at least one of filtering strength, filtering coefficient, or number of taps (e.g., number of filtering coefficients, filtering length). The plurality of intra-frame filter candidates may be defined at least one of a sequence level, a picture level, a slice level, and a block level. That is, a sequence, a picture, a slice, or a block including the current block may use the same plurality of intra-frame filter candidates.

[0228] Hereinafter, for convenience of explanation, it is assumed that the plurality of intra filter candidates include a first intra filter and a second intra filter. It is also assumed that the first intra filter is a (1,2,1) 3-tap filter and the second intra filter is a (2,3,6,3,2) 5-tap filter.

[0229] When the reference samples are filtered by applying the first intra filter, the filtered reference samples may be obtained as shown in Equation 7.

[0230] [Equation 7]

[0231] P(-1,-1)=(P(-1,0)+2P(-1,-1)+P(0,-1)+2)>>2

[0232] P(-1,y)=(P(-1,y+1)+2P(-1,y)+P(-1,y-1)+2)>>2

[0233] P(x,-1)=(P(x+1,-1)+2P(x,-1)+P(x-1,-1)+2)>>2

[0234] When the reference sample is filtered by applying the second intra filter, the filtered reference sample may be obtained as shown in Equation 8 below.

[0235] [Equation 8]

[0236] P(-1,-1)=(2P(-2,0)+3P(-1,0)+6P(-1,-1)+3P(0,-1)+2P(0,-2)+8)>>4

[0237] P(-1,y)=(2P(-1,y+2)+3P(-1,y+1)+6P(-1,y)+3P(-1,y-1)+2P(-1,y-2)+8)>>4

[0238] P(x,-1)=(2P(x+2,-1)+3P(x+1,-1)+6P(x,-1)+3P(x-1,-1)+2P(x-2,-1)+8)>>4

[0239] Based on the position of the reference sample, one of the multiple intra-frame filter candidates can be determined and used to perform filtering on the reference sample by using the determined one intra-frame filter. For example, a first intra-frame filter can be applied to the reference sample at the boundary of the current block, and a second intra-frame filter can be applied to other reference samples. Specifically, Fig.17As shown, the reference samples P(-1, -1), P(-1, 0), P(-1, 1) ... P(-1, N-1) and P(0, -1), P(1, -1) ... are filtered by applying the first intra-frame filter shown in Equation 7, and the other reference samples are filtered by applying the second reference filter shown in Equation 8.

[0240] One of a plurality of intra filter candidates may be selected based on a transform type for a current block, and filtering may be performed on a reference sample using the selected intra filter. Here, the transform type may mean: (1) a transform scheme, e.g., DCT, DST, or KLT, (2) a transform mode indicator, e.g., 2D transform, 1D transform, or non-transform, or (3) the number of transforms, e.g., a first transform and a second transform. Hereinafter, for ease of description, it is assumed that the transform type means a transform scheme (e.g., DCT, DST, and KLT).

[0241] For example, if the current block is encoded using DCT, filtering may be performed using a first intra-frame filter, and if the current block is encoded using DST, filtering may be performed using a second intra-frame filter. Alternatively, if the current block is encoded using DCT or DST, filtering may be performed using a first intra-frame filter, and if the current block is encoded using KLT, filtering may be performed using a second intra-frame filter.

[0242] Filtering may be performed using a filter selected based on the transform type of the current block and the position of the reference sample. For example, if the current block is encoded using DCT, the reference samples P(-1, -1), P(-1, 0), P(-1, 1) ... P(-1, N-1) and P(0, -1), P(1, -1) ... P(N-1, -1) may be filtered by using a first intra-frame filter, and other reference samples may be filtered by using a second intra-frame filter. If the current block is encoded using DST, the reference samples P(-1, -1), P(-1, 0), P(-1, 1) ... P(-1, N-1) and P(0, -1), P(1, -1) ... P(N-1, -1) may be filtered by using a second intra-frame filter, and other reference samples may be filtered by using the first intra-frame filter.

[0243] One of a plurality of intra-frame filter candidates may be selected based on whether a transform type of a neighboring block including a reference sample is the same as a transform type of a current block, and filtering may be performed using the selected intra-frame filter candidate. For example, when the current block and the neighboring block use the same transform type, filtering is performed using a first intra-frame filter, and when the transform types of the current block and the neighboring block are different from each other, a second intra-frame filter may be used to perform filtering.

[0244] Any one of a plurality of intra-frame filter candidates may be selected based on the transform type of the neighboring block, and the reference sample may be filtered using the selected one intra-frame filter. That is, a specific filter may be selected considering the transform type of the block including the reference sample. For example, Fig.18 As shown, if the block adjacent to the left / lower-left side of the current block is a block encoded using DCT, and the block adjacent to the upper / upper-right side of the current block is a block encoded using DST, the reference samples adjacent to the left / lower-left side of the current block are filtered by applying a first intra-frame filter, and the reference samples adjacent to the upper / upper-right side of the current block are filtered by applying a second intra-frame filter.

[0245] In the unit of the predetermined area, the filter that can be used in the corresponding area can be defined. In this article, the unit of the predetermined area can be any one of the following: sequence, picture, slice, block group (e.g., row of coding tree unit) or block (e.g., coding tree unit). Alternatively, another area that shares one or more filters can be defined. The reference sample can be filtered by using a filter mapped to the area including the current block.

[0246] For example, Fig.19 As shown, different filters in the CTU unit may be used to perform filtering on the reference sample. In this case, information indicating whether the same filter is used in a sequence or a picture, the type of filter used for each CTU, and the index of the filter used in the corresponding CTU specified in the available intra-frame filter candidates may be transmitted by signaling via a sequence parameter set (SPS) or a picture parameter set (PPS).

[0247] The coding unit may be split into at least one or more transformation units. At this time, the transformation unit may have a square shape or a non-square shape according to a splitting mode for the transformation unit.

[0248] The coding unit may be divided into two or more transformation units by dividing the coding unit into at least one of upper and lower horizontal lines or left and right vertical lines. As an example, quadtree division may be used, in which the coding unit is divided into four transformation units using horizontal lines that divide the coding unit into upper and lower horizontal lines and vertical lines that divide the coding unit into left and right vertical lines. Alternatively, binary tree division may be used, in which the coding unit is divided into two transformation units using horizontal lines or vertical lines. In addition to the examples described above, the following division scheme may be used: a coding unit is divided into multiple transformation units using multiple vertical lines or multiple horizontal lines.

[0249] Whether to divide the coding unit in a quadtree type may be specified by a syntax element signaled from the bitstream. This may be a 1-bit flag, but is not limited thereto.

[0250] In addition, whether the coding unit is divided in a binary tree type may be specified by a syntax element transmitted by a signal from the self-stream. This may be a 1-bit flag, but is not limited to this. When the coding unit is indicated to be divided in a binary tree type, information indicating the direction of division of the coding unit may be additionally transmitted by a signal. At this time, the division direction may indicate whether the coding unit is divided by a vertical line or a horizontal line.

[0251] The transformation unit generated by splitting the coding unit may be split again into at least one transformation unit. For example, the transformation unit generated by splitting the coding unit may be split in a quadtree or binary tree type.

[0252] Fig. 20 is a diagram illustrating an example of dividing a coding unit into blocks having a square shape.

[0253] When it is determined that the coding unit is divided in a quadtree type, the coding unit may be divided into four transform units. When the coding unit is divided into four transform units, it may be determined for each transform unit whether to further divide the transform unit. As an example, for four transform units, it may be determined whether to split each transform unit in a quadtree or binary tree type.

[0254] For example, in Fig. 20 In the example shown, it is shown that the first and second transform units of the four transform units generated by dividing the coding unit in the quadtree type are divided again in the quadtree type. In addition, it is shown that the first and third transform units of the four transform units generated by dividing the second transform unit are divided again in the quadtree type.

[0255] In this way, the transform units can be recursively divided. Fig. 20 As shown, a coding unit may include transform units of different sizes.

[0256] Fig.21 is a diagram illustrating an example of dividing a coding unit into blocks having a non-square shape.

[0257] Similar to the prediction unit, the coding unit may be divided to have a non-square shape. In one example, the coding unit may be divided into an N×2N or 2N×N shape. When the coding unit is divided to have a non-square shape, it may be determined for each transformation unit whether to further divide the transformation unit. As an example, for two transformation units, it may be determined whether to further split each transformation unit in a quadtree type or a binary tree type.

[0258] For example, in Fig.21 In the example shown in (a), the first block of the N×2N blocks generated by dividing the coding unit into non-square blocks is divided into a quadtree type. In addition, the first transformation unit of the four transformation units generated by dividing the first transformation unit into a quadtree type is divided into a quadtree type again.

[0259] In addition, Fig.21 In the example shown in (b), the first and second blocks of the 2N×2N block generated by dividing the coding unit by the quadtree type are divided into a 2N×N binary tree type. In addition, the first transformation unit of the two transformation units generated by dividing the first transformation unit by the 2N×N binary tree type is divided into a quadtree type.

[0260] A split mode for a transformation unit or whether to further split the transformation unit may be determined according to at least one of a size of the transformation unit, a shape of the transformation unit, a prediction mode for a prediction unit, or a split mode.

[0261] For example, the splitting pattern of the transform unit may be limited by the shape of the transform unit. As a specific example, when the transform unit has a shape in which the height is longer than the width, the splitting pattern for the transform unit may be limited to a shape in which the lower node transform unit generated as a result of the splitting of the transform unit has a shape in which the width is longer than the height.

[0262] For example, when the upper node transformation unit has a 2N×N shape, the lower node transformation unit included in the upper node transformation unit may be limited to have a 2N×N shape. Therefore, the division mode for the upper node transformation unit may be limited to a quadtree type.

[0263] Alternatively, when the height of the transformation unit is greater than the width, the split pattern for the transformation unit may be restricted so that a lower-node transformation unit generated as a result of the split of the transformation unit has a shape in which the height is longer than the width.

[0264] For example, when the upper node transformation unit has an N×2N shape, the lower node transformation unit included in the upper node transformation unit may be restricted to have an N×2N shape. Therefore, a division mode for the upper node transformation unit may be restricted to a quadtree type.

[0265] As another example, the splitting mode for the transform unit may be determined based on the splitting mode for the prediction unit. As a specific example, when the prediction unit is split into a square shape (e.g., 2N×2N), the transform unit may be split only into a square shape. On the other hand, when the prediction unit is split into a non-square shape (e.g., 2N×N or N×2N), the transform unit may be split only into a non-square shape.

[0266] It can be set that when the transformation unit has a non-square shape, the transformation unit can only be divided in a quadtree type and cannot be divided in a binary tree type. For example, when the transformation unit has an N×2N or 2N×N shape, the transformation unit can be divided in a quadtree type to include four N×2N blocks or four 2N×N blocks.

[0267] As another example, it may be arranged that the transform unit may not be further divided when the transform unit has a non-square shape.

[0268] A transform unit is a basic unit of transform, and inverse transform may be performed on each transform unit.

[0269] In the following, reference will be made to Fig. 22 An example of performing inverse transformation on a current block is described in detail. Here, the current block may refer to a transformation unit (transformation block) which is a unit for performing inverse transformation.

[0270] Fig. 22 is a flowchart illustrating a process of performing an inverse transform on a current block.

[0271] First, the decoder may decode information indicating whether to skip inverse transform from a bitstream for a current block ( S2210 ).

[0272] The information indicates whether at least one of inverse transform for a vertical direction or inverse transform for a horizontal direction is skipped for the current block. Here, the information may be a 1-bit flag (eg, 'transform_skip_flag'), but is not limited thereto.

[0273] If the information indicates that the inverse transform is skipped for the current block, at least one of the vertical inverse transform or the horizontal inverse transform for the current block may be skipped. At this time, it is adaptively determined whether to skip one of the vertical inverse transform and the horizontal inverse transform for the current block based on the size, shape or prediction mode of the current block.

[0274] For example, if the current block is a non-square shape having a width greater than a height (e.g., when the current block has a 2N×N shape), the vertical inverse transform may be skipped, but the horizontal inverse transform may not be skipped. If the current block is a non-square shape having a height greater than a width (e.g., when the current block has an N×2N shape), the horizontal inverse transform may be skipped, but the vertical inverse transform may not be skipped. On the other hand, when the current block is a square shape, both the vertical inverse transform and the horizontal inverse transform may be skipped.

[0275] As another example, if the information indicates skipping of inverse transform for the current block, the decoder may further decode information indicating a skipping direction of the inverse transform from the bitstream. Here, the information indicating a skipping direction of the inverse transform may indicate a horizontal direction, a vertical direction, or both directions.

[0276] The decoder may skip at least one of horizontal direction inverse transform and vertical direction inverse transform for the current block based on the information indicating the skip direction of the inverse transform.

[0277] The information indicating whether to skip the inverse transform for the current block may include information indicating whether to skip the inverse transform in the horizontal direction for the current block and information indicating whether to skip the inverse transform in the vertical direction for the current block. Each piece of information may be a 1-bit flag (e.g., 'hor_transform_skip_flag' indicating whether to skip the inverse transform in the horizontal direction or 'ver_transform_skip_flag' indicating whether to skip the inverse transform in the vertical direction), but is not limited thereto.

[0278] At this time, information indicating whether it is inverse transform in the horizontal direction and information indicating whether it is inverse transform in the vertical direction may be adaptively transmitted by signal according to the size, type or prediction mode of the current block.

[0279] For example, when the current block has a non-square shape, the decoder may decode only one of the information indicating whether to skip the inverse transform in the horizontal direction or the information indicating whether to skip the inverse transform in the vertical direction from the bitstream. As a specific example, when the current block is a non-square shape having a width greater than a height, the information indicating whether to skip the inverse transform in the vertical direction may be transmitted by a signal through the bitstream, while the information indicating whether to skip the inverse transform in the horizontal direction may not be transmitted by a signal through the bitstream. When the current block is a non-square shape having a height greater than a width, the information indicating whether to skip the inverse transform in the horizontal direction may be transmitted by a signal through the bitstream, while the information indicating whether to skip the inverse transform in the vertical direction may not be transmitted by a signal through the bitstream.

[0280] On the other hand, when the current block has a square shape, the decoder may decode both information indicating whether to skip inverse transform in the horizontal direction and information indicating whether to skip inverse transform in the vertical direction from the bitstream.

[0281] If it is determined to perform inverse transform on the current block for at least one of the vertical direction or the horizontal direction (S2220), the decoder may determine a transform type for the current block (S2230). The decoder may perform inverse transform on the current block based on the transform type for the current block (S2240).

[0282] The transform type includes a transform scheme such as DCT, DST, or KLT. Here, DCT includes at least one of DCT-II or DCT-VIII, and DST includes at least one of DST-I or DST-VII.

[0283] The transform type of the current block can be determined based on the prediction mode of the current block and the size of the current block. For example, if the current block is a 4×4 block encoded in intra mode, inverse transform is performed using DST-VII, and if the current block does not meet those conditions, inverse transform can be performed using DCT-II.

[0284] As an example, the DST-VII matrix for a 4×4 block can be represented as the following A 4 .

[0285]

[0286] The inverse transformation using DST-VII can be done using the inverse DST-VII matrix A 4 T to execute.

[0287] The DCT-II matrix for an 8×8 block can be expressed as the following T 8 .

[0288]

[0289] The inverse transform using DCT-II can be done using the inverse DCT-II matrix T 8 T to execute.

[0290] As another example, the decoder may determine a transform set for the current block and determine a transform type for the current block based on the determined transform set. Here, the transform set may be obtained in units of transform units, coding units, or coding tree units. As another example, the transform set may be obtained for a transform unit or coding unit whose size or depth is greater than or equal to a predetermined value.

[0291] For ease of explanation, in the embodiments described below, it is assumed that a transform set is obtained for a transform unit including multiple transform units or for a coding unit including multiple transform units, and the unit from which the transform set is obtained will be referred to as a "basic unit".

[0292] First, when a transform set is determined in units of coding units or transform units, transform types of multiple transform units included in a basic unit may be determined based on the determined transform set. At this time, the transform set may include multiple transform types.

[0293] The transform type of the transform unit included in the basic unit may be determined as at least one of the multiple transform types included in the transform set. For example, the transform type of the transform unit may be adaptively determined according to the shape of the transform unit, the size of the transform unit, or the prediction mode. As a specific example, when it is assumed that the transform set includes two transform types, when the transform unit to be inversely transformed satisfies a predetermined condition, the transform type of the transform unit may be determined as the first transform type of the two transform types. On the other hand, when the transform unit to be inversely transformed does not satisfy the predetermined condition, the transform type of the transform unit may be determined as the second transform type of the two transform types.

[0294] Table 3 is a table showing transformation set candidates.

[0295] [Table 3]

[0296] Transform Set Index Transformation Set Candidate 0 Transformation set candidate 1 0 DST-VII DCT-II 1 DST-VII DST-I 2 DST-VII DCT-VIII

[0297] The transform set may be identified by a transform set index, and the transform set of the current block may be specified by index information indicating the transform set index. The index information related to the transform set of the current block may be decoded from a bitstream.

[0298] In Table 3, "transform type candidate 0" indicates a transform type used when a transform unit satisfies a predetermined condition, and "transform type candidate 1" indicates a transform type used when the transform unit does not satisfy the predetermined condition. Here, the predetermined condition may indicate whether the transform unit has a square shape, whether the size of the transform unit is less than or equal to a predetermined value, whether the coding unit is encoded in an intra prediction mode, and the like.

[0299] For example, the predetermined condition may indicate whether the transform unit is a block equal to or less than 4×4 encoded in intra-frame prediction mode. In this case, transform type candidate 0 is applied to the 4×4 transform unit encoded in intra-frame prediction mode that satisfies the predetermined condition, and transform type candidate 1 is applied to other transform units that do not satisfy the predetermined condition. For example, when transform set 0 is selected as the transform set of the current block, if the current block is a block equal to or less than 4×4 encoded in intra-frame prediction mode, DST-VII is determined as the transform type. And if the current block is not a block equal to or less than 4×4 encoded in intra-frame prediction mode, DCT-II may be applied.

[0300] The predetermined condition may be variably set according to the transform set. For example, when transform set 0 or transform set 1 is selected as the transform set for the current block, one of transform type candidate 0 or transform type candidate 1 may be determined as the transform type of the current block according to whether the current block is a block equal to or smaller than 4×4 and encoded in an intra-frame prediction mode. On the other hand, when transform set 2 is selected as the transform set for the current block, one of transform type candidate 0 or transform type candidate 1 may be determined as the transform type of the current block according to whether the current block is a block equal to or smaller than 8×8 and encoded in an intra-frame prediction mode.

[0301] Therefore, when the transform set for the basic unit is determined to be transform set 0, DST-VII can be applied to the 4×4 transform unit encoded in the intra-frame prediction mode included in the basic unit, and DCT-II can be applied to other transform units. On the other hand, when the transform set for the basic unit is determined to be transform set 2, DST-VII can be applied to the 4×4 transform unit encoded in the intra-frame prediction mode or the 8×8 transform unit encoded in the intra-frame prediction mode included in the basic unit, and DCT-VIII can be applied to other transform units.

[0302] The predetermined condition may be adaptively determined according to the size, shape, or prediction mode of the basic unit. For example, when the size of the basic unit (e.g., coding unit) is less than or equal to 32×32, the predetermined condition may indicate whether the transform unit is a block equal to or less than 4×4 encoded in an intra-frame prediction mode. On the other hand, when the size of the basic unit (e.g., coding unit) is greater than 32×32, the predetermined condition may indicate whether the transform unit is a block equal to or less than 8×8 encoded in an intra-frame prediction mode.

[0303] Therefore, when the size of the basic unit is less than or equal to 32×32, transform type candidate 0 may be applied to a 4×4 transform unit encoded in an intra prediction mode included in the basic unit, and transform type candidate 1 may be applied to other transform units. On the other hand, when the size of the basic unit is greater than 32×32, transform type candidate 0 may be applied to a 4×4 transform unit encoded in an intra prediction mode or an 8×8 transform unit encoded in an intra prediction mode included in the basic unit, and transform type candidate 1 may be applied to other transform units.

[0304] If it is determined that both the horizontal inverse transform and the vertical inverse transform are performed on the current block, a transform set for the horizontal direction of the current block and a transform set for the vertical direction of the current block may be determined respectively. For example, the horizontal inverse transform of the current block is performed using transform set 0, and the vertical inverse transform of the current block is performed using transform set 1.

[0305] Whether to use different transform sets for the horizontal direction and the vertical direction of the current block may be adaptively determined based on the size, shape, or prediction mode of the current block or the basic unit.

[0306] For example, Fig.23 An example of determining a transform set of a transform unit based on an intra prediction mode of a prediction unit is shown.

[0307] Whether to use different transform sets for the horizontal direction and the vertical direction may be determined according to the intra prediction mode of the prediction unit corresponding to the current block. For example, when the intra prediction mode of the prediction unit is a vertical direction or a horizontal direction, or when the intra prediction mode of the prediction unit is similar to the vertical direction or similar to the horizontal direction, different transform sets may be used for the horizontal direction and the vertical direction of the current block. If the intra prediction mode of the prediction unit is a non-directional mode, or is not the same as or similar to the vertical direction or the horizontal direction, the same transform set may be used for the horizontal direction and the vertical direction of the current block.

[0308] Here, the intra prediction mode similar to the vertical direction or the horizontal direction is an intra prediction mode having a direction similar to the intra prediction mode having the vertical direction or the horizontal direction. And the intra prediction mode similar to the vertical direction or the horizontal direction means an intra prediction mode whose difference with the intra prediction mode having the vertical direction or the horizontal direction is less than or equal to the threshold value. For example, as in Fig.23 In the example shown, if the intra-frame prediction mode includes 33 directional intra-frame prediction modes, an intra-frame prediction mode having a difference equal to or less than ±3 with an intra-frame prediction mode having a horizontal direction or a vertical direction (10, 26) can be determined as an intra-frame prediction mode similar to the vertical direction or the horizontal direction.

[0309] As described above, the transform set of the basic unit may be determined based on the index information signaled through the bitstream. At this time, for the basic unit, the transform set in the horizontal direction and the transform set in the vertical direction may be determined separately. The transform set in the horizontal direction for the basic unit may be specified by the first index information, and the transform set in the vertical direction for the basic unit may be specified by the second index information. The transform type of the transform unit included in the basic unit may be determined based on the transform set determined for the basic unit.

[0310] As another example, the transform set for the current block may be determined based on at least one of: a size of the current block, a shape of the current block, a prediction mode of the current block, or a transform set of a unit decoded before the current block.

[0311] For example, units having the same intra prediction mode among a plurality of units included in a coding unit or a transform unit may be set to use the same transform set.

[0312] As a specific example, assume that the first transform unit in the scan order has an intra prediction mode in the vertical direction, and assume that transform set 2 is used for the horizontal direction and transform set 0 is used for the vertical direction of the first transform unit. In this case, the transform unit with the intra prediction mode in the vertical direction can have the same transform set as the first transform unit with the intra prediction mode in the vertical direction. Therefore, like the first transform unit with the intra prediction mode in the vertical direction, the transform unit with the intra prediction mode in the vertical direction can use transform set 2 for the horizontal direction and transform set 0 for the vertical direction.

[0313] In this case, index information may be signaled only for the first transform unit having an intra prediction mode in a vertical direction, and index information may not be signaled for other transform units having intra prediction modes in a vertical direction.

[0314] In addition, units having similar intra prediction modes among a plurality of transform units included in a coding unit or a transform unit may be set to use the same transform set. At this time, intra prediction modes included in a range where the difference with the intra prediction mode along a predetermined direction is equal to or less than a threshold value may be determined to be similar to each other. For example, when the predetermined direction is a horizontal direction or a vertical direction, intra prediction modes included in a range where the difference with the horizontal or vertical intra prediction mode is ±3 or less may be determined to be similar to each other.

[0315] As a specific example, assume that the first transform unit in the scanning order has an intra-frame prediction mode in a vertical direction or a direction close to the vertical direction, and assume that transform set 2 is used for the horizontal direction and transform set 0 is used for the vertical direction of the first transform unit. In this case, the transform unit having an intra-frame prediction mode in a vertical direction or a direction close to the vertical direction can have the same transform set as another transform unit having an intra-frame prediction mode in a vertical direction or a direction close to the vertical direction. When it is assumed that the intra-frame prediction mode whose difference with the vertical direction is equal to or less than 3 is similar to the vertical direction, the transform unit having an intra-frame prediction mode of any one of 23-29 can use transform set 2 for the horizontal direction and transform set 0 for the vertical direction, like the first transform unit having an intra-frame prediction mode of any one of 23-29.

[0316] In this case, index information may be transmitted by signal only for the first transform unit having an intra-prediction mode in a vertical direction or close to the vertical direction, and index information may not be transmitted by signal for other transform units having intra-prediction modes in a vertical direction or close to the vertical direction.

[0317] The transform set for the current block may be determined according to the intra prediction mode of the prediction unit related to the current block. For example, Table 4 shows the transform set indexes in the horizontal direction and the vertical direction according to the intra prediction mode of the current block.

[0318] [Table 4]

[0319] Intra mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Horizontal (H) 2 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 Vertical (V) 1 1 0 1 0 1 0 1 2 2 2 2 2 1 0 1 0 1 Intra mode 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Horizontal (H) 0 1 0 1 0 1 2 2 2 2 2 1 0 1 0 1 0 Vertical (V) 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0

[0320] As shown in Table 4, a transform set of the current block may be determined according to an intra prediction mode of a prediction unit related to the current block.

[0321] If the basic unit is encoded with inter-frame prediction, the process of determining the transform set for the current block can be omitted. That is, if the basic unit is encoded with inter-frame prediction, the current block can be inversely transformed without using the transform set. In this case, the transform type of the current block can be determined as DCT, DST, or KLT according to the size and shape of the current block.

[0322] When encoding a basic unit with inter prediction, a transform set for a current block is determined, and only a portion of a plurality of transform type candidates included in the transform set may be used for inverse transform of the current block. For example, when it is assumed that the transform set of the current block includes transform type candidate 0 and transform type candidate 1 as shown in Table 3, regardless of whether the current block satisfies a predetermined condition, the transform type of the current block may be determined as transform type candidate 0 or transform type candidate 1.

[0323] In the above Table 3, it is shown that the transform set includes two transform type candidates. The number of transform type candidates included in the transform set is not limited to two. The number of transform type candidates included in the transform set may be one, three, four or more.

[0324] The maximum number of transform type candidates that a transform set may include may be determined based on information signaled from a bitstream. For example, information about the maximum number of candidates in a transform set may be signaled via a slice header or a sequence header, and the maximum number of transform type candidates available in a slice or sequence may be determined by the information.

[0325] Meanwhile, the number of candidates included in the transform set or the transform type candidates included in the transform set may be adjusted according to information indicating whether inverse transform skipping is allowed in a picture. Here, the information indicating whether inverse transform skipping is allowed in a picture may be a 1-bit flag (eg, 'transform_skip_enabled_flag'), but is not limited thereto.

[0326] For example, if 'transform_skip_enabled_flag' indicates that inverse transform skipping is allowed in a picture, the transform set may further include 'transform skip' as a candidate, as shown in the example of Table 5. If 'transform_skip_enabled_flag' indicates that inverse transform skipping is not allowed in a picture, the transform set does not include 'transform skip' as a candidate, as shown in the example of Table 5.

[0327] [Table 5]

[0328] Transform Set Index Transform Candidate 0 Transformation candidate 1 Transformation Candidate 2 0 DST-VII DCT-II Transform Skip 1 DST-VII DST-I Transform Skip 2 DST-VII DCT-VIII Transform Skip

[0329] Since the transform set includes multiple transform type candidates, the inverse transform scheme using the transform type may be referred to as AMT (Adaptive Multi-Transform). Meanwhile, whether to use AMT (i.e., whether to use the transform set to determine the transform type of the current block) may be selectively determined according to the size or depth of the current block or basic unit. For example, the current block may determine the transform type using the transform set only when the size of the coding unit including the current block is less than or equal to a predetermined size. Here, the maximum size of the coding unit allowing AMT may be signaled through a slice header or a sequence header.

[0330] Next, a process of obtaining a quantization parameter for a current block will be described.

[0331] In the encoding process, the quantization parameter determines the quality of the image after the transform process. The quantized transform coefficient can be obtained by dividing the transform coefficient obtained by the transform process by a value specified by the quantization parameter.

[0332] In the decoding step, dequantized transform coefficients are obtained by inverse quantization, which is performed by multiplying the quantized transform coefficients by a value specified by a quantization parameter.

[0333] Different quantization parameters may be applied to each block or each region within a picture. Here, blocks or regions to which the same quantization parameter is applied may be referred to as "quantization groups" (QGs).

[0334] In order to obtain the quantization parameter of the quantization group, the quantization parameter and the quantization parameter difference (DeltaQP, dQp) of the picture or slice may be transmitted by a signal. The quantization parameter difference indicates the difference between the quantization parameter of the quantization group and the quantization parameter prediction value. At this time, when the quantization group is the first group in the picture or slice, the quantization parameter of the picture or slice may be set to the quantization parameter prediction value of the quantization group.

[0335] The size of the quantization group may be determined according to a syntax element indicating the size of the quantization group and the size of the coding tree unit. For example, Table 6 shows the size of the quantization group according to 'diff_cu_qp_delta_depth' indicating the size of the quantization group and the size of the coding tree unit.

[0336] [Table 6]

[0337]

[0338] Here, 'diff_cu_qp_delta_depth' represents a difference between the size of the coding tree unit and the size of the quantization group.

[0339] The quantization parameter difference value may be signaled for a coding unit or a transformation unit having a non-zero transform coefficient.When the coding tree unit is split into a plurality of coding units, the quantization parameter difference value may be signaled for a coding unit or a transformation unit having a non-zero transform coefficient.

[0340] In the encoding step, the encoder may obtain a quantization parameter difference value based on a value (e.g., an average value) related to the current block to be encoded. Hereinafter, a method for obtaining a quantization parameter difference value based on a value related to the current block will be described in detail with reference to the accompanying drawings. For ease of explanation, in the implementation described later, the value related to the current block is referred to as the average value of the current block.

[0341] Fig.24 is a flowchart illustrating a method for obtaining a quantization parameter difference value according to an embodiment of the present invention. In embodiments described later, the current block may mean a quantization group, a coding tree unit, a coding unit, or a transform unit corresponding to a unit for obtaining a quantization parameter.

[0342] In order to obtain the quantization parameter difference, an average value of the current block may be calculated (S2410). The average value of the current block may be obtained based on the prediction sample and the transform coefficient.

[0343] Specifically, the average value of the current block can be obtained by adding the average value of the prediction samples in the current block to the value obtained by measuring the DC component (i.e., DC coefficient) of the transform coefficient. At this time, the DC component may mean a coefficient corresponding to the DC component in the transform coefficient generated by transforming the residual sample. Equation 9 shows a method of obtaining the average value of the current block.

[0344] [Equation 9]

[0345] intL = Mean(prediction) + scale * DC_coefficient

[0346] The scaling value for the DC coefficient may be a fixed value or a variable determined according to the size of the current block.

[0347] In Equation 9, Mean(prediction) represents the mean value of the prediction samples.

[0348] If the average value of the current block is calculated, the quantization parameter difference value of the current block may be determined based on the average value of the current block (S2420). The quantization parameter difference value may be obtained by referring to a lookup table (LUT) defining a relationship between the average value and the quantization parameter difference value.

[0349] Here, the lookup table can be defined so that a small number of bits are used in the dark part of the picture (i.e., a large number of quantization parameters are used) and a large number of bits are used in the bright part of the picture (i.e., a small quantization parameter is used). Therefore, as the average value of the current block increases, the quantization parameter difference can tend to decrease.

[0350] For example, Table 7 shows a lookup table defining quantization parameter differences according to a mean value.

[0351] [Table 7]

[0352] The range of average values ​​in the block QDQ intL<301 3 301≤intL<367 2 367≤intL<434 1 434≤intL<501 0 501≤intL<567 -1 567≤intL<634 -2 634≤intL<701 -3 701≤intL<767 -4 767≤intL<834 -5 intL>=834 -6

[0353] In Table 7, intL represents an average value, and dQp represents a quantization parameter difference value.

[0354] The lookup table for obtaining the quantization parameter difference value may be determined according to the size of the current block. For example, the lookup table for obtaining the quantization parameter difference value may be adaptively determined according to the size of the coding tree unit, coding unit, transform unit or prediction unit.

[0355] Taking the coding tree unit as an example, there is the possibility that a region including a coding tree unit having a small size may have a more complex texture or more objects than a region including a coding tree unit having a large size. On the other hand, a region including a coding tree unit having a large size may be a region including a simple texture or background that is more uniform than a region including a coding tree unit having a small size. Therefore, subjective image quality can be improved and encoding performance can be improved by allocating more bits to a small coding tree unit that may have many complex textures (i.e., using a small quantization parameter).

[0356] To this end, by using different lookup tables according to the size of the coding tree unit, a small-sized coding tree unit can have a small quantization parameter difference value and a large-sized coding tree unit can have a large quantization parameter difference value. For example, if the size of the coding tree unit is greater than 32×32, the lookup table of Table 8 below is used, and if the size of the coding tree unit is less than 32×32, the lookup table of Table 7 can be used.

[0357] [Table 8]

[0358] The range of average values ​​in the block QDQ intL<401 3 401≤intL<434 2 434≤intL<501 1 501≤intL<567 0 567≤intL<634 -1 634≤intL<701 -2 701≤intL<767 -3 767≤intL<834 -4 834≤intL<902 -5 intL>=902 -6

[0359] As another example, a lookup table for obtaining a quantization parameter difference value may be determined according to a prediction mode of the current block. For example, a lookup table for obtaining a quantization parameter difference value may be adaptively determined according to whether the coding unit is encoded in an intra-frame prediction mode, an inter-frame prediction mode, or an intra-frame block copy mode.

[0360] For example, when the coding unit is encoded in intra prediction, the quantization parameter difference value may be obtained by using the lookup table in Table 7. Also, when the coding unit is encoded in intra prediction mode or intra block copying, the quantization parameter difference value may be obtained by using the lookup table in Table 8.

[0361] As another example, a lookup table for obtaining a quantization parameter difference value may be determined according to a transform type of a current block or a transform set of a current block. For example, when the transform type of a transform unit is DCT, the quantization parameter difference value may be obtained by using the lookup table in Table 7. Also, when the transform type of a transform unit is DST, the quantization parameter difference value may be obtained by using the lookup table in Table 8.

[0362] As another example, the lookup table for obtaining the quantization parameter difference value may be determined according to whether the second transform is performed on the current block. For example, when the second transform is applied to the transform unit, the quantization parameter difference value may be obtained by using the lookup table in Table 7. Also, when the second transform is not applied to the transform unit, the quantization parameter difference value may be obtained by using the lookup table in Table 8.

[0363] As another example, a lookup table for obtaining a quantization parameter difference value may be determined based on a maximum pixel value, a minimum pixel value, or a difference between a maximum pixel value and a minimum pixel value in a current block. For example, when a maximum pixel value in a coding tree unit is less than a certain threshold, a quantization parameter difference value may be obtained by using a lookup table in Table 7. Also, when a maximum pixel value in a coding tree unit is greater than a certain threshold, a quantization parameter difference value may be obtained by using a lookup table in Table 8.

[0364] The present disclosure may also have the following configurations:

[0365] 1. A method for decoding a video, the method comprising:

[0366] Determine a transform set for a current block, the transform set comprising a plurality of transform type candidates;

[0367] Determine a transform type of the current block from among the plurality of transform type candidates; and

[0368] An inverse transform is performed on the current block based on a transform type of the current block.

[0369] 2. The method according to scheme 1, wherein the transform type of the current block is adaptively selected from the multiple transform type candidates according to whether the current block meets a predetermined condition.

[0370] 3. The method according to scheme 2, wherein the predetermined condition is adaptively determined according to the size of the current block.

[0371] 4. The method according to claim 1, wherein the inverse transform comprises a horizontal transform and a vertical transform for the current block, and

[0372] The transformation set includes a first transformation set for horizontal transformation and a second transformation set for vertical transformation.

[0373] 5. The method according to scheme 1, wherein the transform set is specified by index information obtained from a bitstream.

[0374] 6. The method according to scheme 1, wherein the transform set is determined based on a transform set of a block having a same or similar prediction mode as the current block among blocks decoded before the current block.

[0375] 7. The method according to claim 1, wherein the method further comprises:

[0376] decoding information indicating whether to skip the inverse transform for the current block; and

[0377] Whether to perform the inverse transform on the current block is determined based on the information.

[0378] 8. The method according to scheme 7, wherein the information includes information indicating whether to skip the horizontal inverse transformation of the current block and information indicating whether to skip the vertical inverse transformation of the current block.

[0379] 9. The method according to scheme 7, wherein, when the information indicates that the inverse transform is skipped for the current block, at least one of the horizontal direction transform or the vertical direction transform is skipped according to the shape of the current block.

[0380] 10. A method for encoding a video, the method comprising:

[0381] Determine a transform set for a current block, the transform set comprising a plurality of transform type candidates;

[0382] Determine a transform type of the current block from among the plurality of transform type candidates; and

[0383] A transform is performed on the current block based on a transform type of the current block.

[0384] 11. The method according to claim 10, wherein the method further comprises:

[0385] determining a quantization parameter residual value for the current block;

[0386] determining a quantization parameter for the current block based on the quantization parameter residual value; and

[0387] Quantization is performed on the current block based on the quantization parameter.

[0388] 12. The method according to claim 11, wherein the quantization parameter residual value is determined based on an average value related to the current block, and

[0389] The average value is determined based on a DC coefficient generated as a result of the transform and a prediction signal of the current block.

[0390] 13. The method according to claim 11, wherein the quantization parameter residual value is determined by referring to a lookup table defining a mapping relationship between the average value and the quantization parameter residual value, and

[0391] The lookup table is determined based on at least one of a size, an intra-prediction mode, a transform type or a pixel value of the current block.

[0392] 14. An apparatus for decoding a video, the apparatus comprising:

[0393] A decoding unit, configured to decode information specifying a transform set of a current block; and

[0394] an inverse transform unit, configured to determine a transform set of the current block based on the information, the transform set comprising a plurality of transform type candidates, to determine a transform type of the current block from the plurality of transform type candidates, and to perform an inverse transform on the current block based on the transform type of the current block.

[0395] 15. An apparatus for encoding a video, the apparatus comprising:

[0396] a transform unit, configured to determine a transform set of a current block, the transform set comprising a plurality of transform type candidates, configured to determine a transform type of the current block from the plurality of transform type candidates, and configured to perform a transform on the current block based on the transform type of the current block; and

[0397] The encoding unit is used to encode information specifying a transformation set of the current block.

[0398] In the above example, it is described that the quantization parameter residual value is determined by using the average value of the current block, and it is also described that the average value is determined by the prediction sample and the DC coefficient of the current block. Different from the description, the quantization parameter residual value can be determined by the prediction sample or the DC coefficient. Alternatively, the prediction sample can be determined based on the average value of the current block, and the average value of the current block can be calculated based on the transform coefficient, the quantized transform coefficient, etc. instead of the DC coefficient.

[0399] In addition, in the above example, it is described about determining the quantization parameter residual value in the encoding process. However, the quantization parameter residual value in the decoding process can also be determined in the same way as in the encoding process. Information specifying a lookup table for obtaining the quantization parameter residual value in the decoder can also be transmitted by signal to the encoder. In this case, the decoder can use the lookup table specified by the information to obtain the quantization parameter.

[0400] As another example, a quantization parameter residual value determined during the encoding process may be signaled to a decoder via a bitstream.

[0401] Although the above-mentioned embodiments have been described based on a series of steps or flow charts, they do not limit the timing of the present invention, and can be performed simultaneously or in different orders as required. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-mentioned embodiments can be realized by hardware devices or software and multiple components. Or, multiple components can be combined and realized by a single hardware device or software. The above-mentioned embodiments can be realized in the form of program instructions, which can be executed by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium can include one or a combination of program commands, data files, data structures, etc. The example of computer-readable media includes magnetic media (e.g., hard disk, floppy disk and tape), optical recording media (e.g., CD-ROM and DVD), magneto-optical media (e.g., optical magnetic floppy disk), and hardware devices and media (e.g., ROM, RAM, flash memory) etc. that are specially configured to store and execute program instructions. The hardware device can be configured to operate as one or more software modules, for performing processing according to the present invention, and vice versa.

[0402] Industrial Applicability

[0403] The present invention can be applied to electronic devices capable of encoding / decoding videos.

Claims

1. A method for decoding a video, the method comprising: determining whether to skip inverse transform for a current transform block based on a transform skip flag, the transform skip flag indicating whether to skip the inverse transform; When it is determined not to skip the inverse transform for the current transform block, determining a transform kernel for the current transform block; as well as performing the inverse transform on the current transform block based on the determined transform kernel, Wherein, determining the transformation kernel of the current transformation block includes: determining one of a plurality of transform kernel sets based on information decoded from the bitstream, and Determine a transform kernel of the current transform block based on one of the plurality of transform kernel sets, Each of the plurality of transform core sets includes a first transform core and a second transform core, each of the first transform core and the second transform core is one of DCT-II, DCT-VIII and DST-VII, and When the current transform block is one of the transform blocks generated by dividing the coding block based on the horizontal partition type or the vertical partition type, the inverse transform is forced not to be skipped in at least one of the vertical direction and the horizontal direction for the current transform block.

2. The method according to claim 1, wherein: When the size of the current transform block is less than or equal to a predefined value, parsing information from the bitstream is performed.

3. The method according to claim 1, wherein: The horizontal transform type and the vertical transform type of the current transform block are determined by referring to one of the plurality of transform kernel sets specified by the information.

4. A method for encoding a video, the method comprising: determining whether to skip transforming for the current transform block; When it is determined not to skip the transform for the current transform block, determining a transform kernel for the current transform block; as well as performing the transform on the current transform block based on the transform kernel, The transform core of the current transform block is determined based on one of a plurality of transform core sets, and information for specifying one of the plurality of transform core sets is encoded into a bitstream, Each of the plurality of transform core sets is configured with a first transform core and a second transform core, each of the first transform core and the second transform core is one of DCT-II, DCT-VIII and DST-VII, and When the current transform block is one of the transform blocks generated by dividing the coding block based on the horizontal partition type or the vertical partition type, it is forced not to skip the transform in at least one of the vertical direction and the horizontal direction for the current transform block.

5. The method according to claim 4, wherein: When the size of the current transform block is less than or equal to a predefined value, encoding the information into the bitstream is performed.

6. The method according to claim 5, wherein: The horizontal transform type and the vertical transform type of the current transform block are determined by referring to one of the plurality of transform kernel sets specified by the information.

7. An apparatus for transmitting a bit stream associated with a video signal, the apparatus comprising: One or more hardware units configured to: Generate a bitstream by encoding a video signal; as well as transmitting the bit stream, The generating of the bitstream includes: determining whether to skip transforming for the current transform block; When it is determined not to skip transforming the current transform block, determining a transform kernel of the current transform block; and performing the transform on the current transform block based on the transform kernel, The transform core of the current transform block is determined based on one of a plurality of transform core sets, and information for specifying one of the plurality of transform core sets is encoded into a bitstream, wherein each of the plurality of transform core sets includes a first transform core and a second transform core, each of the first transform core and the second transform core is one of DCT-II, DCT-VIII and DST-VII, and When the current transform block is one of the transform blocks generated by dividing the coding block based on the horizontal partition type or the vertical partition type, it is forced not to skip the transform in at least one of the vertical direction and the horizontal direction for the current transform block.

Citation Information

Patent Citations

  • Apparatus of decoding video data

    CN103096066A

  • An adaptive transform method based on an in-frame prediction, and an apparatus using the method

    CN104378633A

  • Decoding device, decoding method, encoding device, and encoding method

    WO2015053115A1