Method and device for decoding video

By using various directional intra prediction modes and predetermined gradient extension line technology in the video codec to encode and decode images, the problem of low efficiency in traditional encoding modes is solved, and more efficient image compression and decoding.

CN109309832BActive Publication Date: 2024-09-24SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201811376393.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2010-10-06
Filing Date
2011-07-15
Publication Date
2024-09-24
Estimated Expiration
2032-11-29

AI Technical Summary

Technical Problem

Videos are encoded based on fixed-size macroblocks in a restricted encoding mode in traditional video codecs, resulting in inefficiencies in encoding and decoding high-resolution or high-quality images.

Method used

Encoding and decoding images using intra prediction modes with various directionality, predicting the current block by dividing the image into blocks with predetermined sizes and determining the pixels of neighboring blocks from neighboring blocks using extension lines with predetermined gradients pixels, reducing the amount of calculation and improving coding efficiency.

Benefits of technology

It improves image compression efficiency, reduces the amount of calculation during intra-frame prediction, and adapts to the encoding requirements of different block sizes, improving the encoding performance of high-resolution videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109309832B_ABST
    Figure CN109309832B_ABST
Patent Text Reader

Abstract

A method and apparatus for decoding a video, providing a method and apparatus for encoding and decoding an image by performing intra-frame prediction using pixels of a neighboring block along an extended line having a predetermined gradient with respect to pixels in a current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with application date of July 15, 2011, application number 201180044566.9, and titled “Method and device for encoding and decoding images through intra-frame prediction”. Technical Field

[0002] Exemplary embodiments of the present disclosure relate to encoding and decoding of an image, and more particularly, to a method and apparatus for encoding and decoding an image through intra-prediction, which can improve image compression efficiency by using intra-prediction modes having various directionalities. Background Art

[0003] According to an image compression standard such as Moving Picture Experts Group (MPEG)-1, MPEG-2, MPEG-4, or H.264 / MPEG-4 Advanced Video Coding (AVC), a picture is divided into macroblocks to encode the image. After encoding each macroblock in any one of an inter-frame prediction encoding mode and an intra-frame prediction encoding mode, an appropriate encoding mode is selected according to a bit rate required for encoding the macroblock and an allowable distortion between an original macroblock and a reconstructed macroblock, and then the macroblock is encoded in the selected encoding mode.

[0004] As hardware for reproducing and storing high-resolution or high-quality image contents develops, demands for video codecs that efficiently encode or decode high-resolution or high-quality video contents are increasing. Summary of the invention

[0005] Technical issues

[0006] In a conventional video codec, a video is encoded based on macroblocks having a predetermined size in a restricted coding mode.

[0007] Technical Solution

[0008] Exemplary embodiments provide a method and apparatus for encoding and decoding an image through intra prediction by using intra prediction modes having various directionality.

[0009] Exemplary embodiments also provide a method and apparatus for encoding and decoding an image through intra prediction, which may reduce the amount of calculation performed during the intra prediction.

[0010] Beneficial Effects

[0011] Since intra prediction is performed in various directions, image compression efficiency can be improved.

[0012] The amount of calculations performed to determine reference pixels during intra prediction may be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 is a block diagram illustrating an apparatus for encoding an image according to an exemplary embodiment;

[0014] Figure 2 is a diagram illustrating the number of intra prediction modes according to a size of a current block according to an exemplary embodiment;

[0015] Figure 3 is a diagram for explaining an intra prediction mode applied to a block having a predetermined size according to an exemplary embodiment;

[0016] Figure 4 is a diagram showing a method according to an exemplary embodiment Figure 3 A diagram of the direction of an intra prediction mode;

[0017] Figure 5 is used to explain the Figure 3 Schematic diagram of an intra-frame prediction method performed by the block shown in;

[0018] Figure 6 is a diagram for explaining an intra prediction mode applied to a block having a predetermined size according to another exemplary embodiment;

[0019] Figure 7 is a reference diagram for explaining intra prediction modes having various directivities according to an exemplary embodiment;

[0020] Figure 8 is a reference diagram for explaining a process of generating a prediction factor when an extended line having a predetermined gradient passes between neighboring pixels at integer positions instead of passing through neighboring pixels at integer positions according to an exemplary embodiment;

[0021] Fig. 9 is a reference diagram for explaining a process of generating a prediction factor when an extended line having a predetermined gradient passes between neighboring pixels at integer positions according to another exemplary embodiment;

[0022] Fig.10 is a reference diagram for explaining a bilinear mode according to an exemplary embodiment;

[0023] Fig.11 is a diagram for explaining a process of generating a prediction value of an intra prediction mode of a current block according to an exemplary embodiment;

[0024] Fig.12 and Fig.13 is a reference diagram for explaining a mapping process for unifying intra prediction modes of blocks having different sizes according to an exemplary embodiment;

[0025] Fig.14is a reference diagram for explaining a process of mapping an intra prediction mode of a neighboring block to one of representative intra prediction modes according to an exemplary embodiment;

[0026] Fig.15 is a diagram for explaining a relationship between a current pixel and neighboring pixels located on an extended line having a directivity of (dx, dy) according to an exemplary embodiment;

[0027] Fig.16 is a diagram for explaining a change of a neighboring pixel located on an extended line having a directivity of (dx, dy) according to a position of a current pixel according to an exemplary embodiment;

[0028] Fig.17 and Fig.18 is a diagram for explaining a method of determining an intra prediction mode direction according to an exemplary embodiment;

[0029] Fig.19 is a flowchart illustrating a method of encoding an image by intra prediction according to an exemplary embodiment;

[0030] Fig. 20 is a block diagram illustrating an apparatus for decoding an image according to an exemplary embodiment;

[0031] Fig.21 is a flowchart illustrating a method of decoding an image through intra prediction according to an exemplary embodiment.

[0032] Best Mode for Carrying Out the Invention

[0033] According to an aspect of an exemplary embodiment, a method for intra-frame prediction encoding of an image is provided, the method comprising: dividing a current picture of the image into at least one block having a predetermined size; determining pixels of a neighboring block from pixels of a neighboring block previously reconstructed before the pixels of the at least one block along an extension line having a predetermined gradient about the pixels of the at least one block; and predicting pixels of the at least one block using the determined pixels of the neighboring block.

[0034] According to another aspect of an exemplary embodiment, a method for intra-prediction decoding of an image is provided, the method comprising: dividing a current picture of the image into at least one block having a predetermined size; extracting intra-prediction mode information indicating an intra-prediction mode applied to the at least one block from a bitstream; performing intra-prediction on the at least one block according to the intra-prediction mode indicated by the extracted intra-prediction mode information, wherein, in the intra-prediction mode, pixels of neighboring blocks predict pixels of the at least one block, and pixels of the neighboring block are determined from pixels of neighboring blocks previously reconstructed before pixels of the at least one block using an extended line with a predetermined gradient about the pixels of the at least one block.

[0035] According to another aspect of an exemplary embodiment, there is provided an apparatus for intra-prediction encoding an image, the apparatus comprising: an intra-prediction unit that determines pixels of a neighboring block from pixels of a neighboring block that was previously reconstructed before the pixels of the current block of the image, using an extended line with a predetermined gradient about pixels of a current block, and predicts pixels of the current block using the determined pixels of the neighboring block.

[0036] According to another aspect of an exemplary embodiment, a device for intra-prediction decoding of an image is provided, the device comprising: an intra-prediction unit, extracting intra-prediction mode information indicating an intra-prediction mode applied to a current block of the image from a bitstream, performing intra-prediction on the current block according to the intra-prediction mode indicated by the extracted intra-prediction mode information, wherein in the intra-prediction mode, pixels of a neighboring block predict pixels of the current block, and determining the pixels of the neighboring block from pixels of a neighboring block previously reconstructed before the pixels of the current block using an extension line with a predetermined gradient about the pixels of the current block. DETAILED DESCRIPTION

[0037] Example embodiments will now be described more fully with reference to the accompanying drawings, in which example embodiments are shown.

[0038] Figure 1 is a block diagram illustrating an apparatus 100 for encoding an image according to an exemplary embodiment.

[0039] Reference Figure 1 The device 100 includes an intra-frame prediction unit 110, a motion estimation unit 120, a motion compensation unit 125, a frequency transformation unit 130, a quantization unit 140, an entropy encoder 150, an inverse quantization unit 160, an inverse frequency transformation unit 170, a deblocking unit 180 and a loop filtering unit 190.

[0040] The motion estimation unit 120 and the motion compensation unit 125 perform inter-frame prediction by dividing the current frame 105 of the current picture into a plurality of blocks each having a predetermined size and searching a prediction value of each block in a reference picture.

[0041] The intra prediction unit 110 performs such intra prediction: searching for a prediction value of a current block by using pixels of neighboring blocks of the current picture. Specifically, the intra prediction unit 110 performs intra prediction modes with various directions by using (dx, dy) parameters in addition to performing a conventional intra prediction mode. The additional intra prediction modes according to the present exemplary embodiment will be explained later.

[0042] A residual value of the current block is generated based on the prediction value output from the intra prediction unit 110 and the motion compensation unit 125 , and is output as a quantized transform coefficient through the frequency transform unit 130 and the quantization unit 140 .

[0043] The quantized transform coefficient is restored to a residual value through the inverse quantization unit 160 and the frequency inverse transform unit 170, and the restored residual value is post-processed through the deblocking unit 180 and the loop filtering unit 190 and output as a reference frame 195. The quantized transform coefficient may be output as a bitstream 155 through the entropy encoder 150.

[0044] Will explain in detail Figure 1 The intra prediction method for improving image compression efficiency will be explained by assuming a codec that can perform compression encoding by using a block having a size greater than or less than 16×16 as a coding unit, rather than a conventional codec (such as H.264) that performs encoding based on a macroblock having a size of 16×16.

[0045] Figure 2 is a diagram illustrating the number of intra prediction modes according to a size of a current block according to an exemplary embodiment.

[0046] The number of intra prediction modes to be applied to a block may vary according to the size of the current block. Figure 2 , when the size of the block to be predicted is N×N, the number of intra prediction modes actually performed on each of the blocks having sizes of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, and 128×128, respectively, may be set to 5, 9, 9, 17, 33, 5, and 5 (in the case of Example 2). In this way, since the overhead for encoding the prediction mode information varies according to the size of the block, the number of intra prediction modes actually performed varies according to the size of the block. In other words, in the case of a block having a small size, although the block occupies a small portion of the entire image, the overhead for transmitting additional information such as the prediction mode of the block having a small size may be high. Therefore, if a block having a small size is encoded by using too many prediction modes, the bit rate is increased, thereby reducing the compression efficiency. In addition, since a block having a large size (e.g., a size greater than 64×64) is often selected as a block for a flat area of ​​an image, the compression efficiency is also reduced when a block having a large size is encoded by using too many prediction modes.

[0047] Therefore, in Figure 2In the embodiment, if the size of a block is roughly divided into at least three sizes N1×N1 (2≤N1≤8, N1 is an integer), N2×N2 (16≤N2≤32, N2 is an integer), and N3×N3 (64≤N3, N3 is an integer), the number of intra-frame prediction modes performed on a block of size N1×N1 is A1 (A1 is a positive integer), the number of intra-frame prediction modes performed on a block of size N2×N2 is A2 (A2 is a positive integer), and the number of intra-frame prediction modes performed on a block of size N3×N3 is A3 (A3 is a positive integer). Preferably, the number of intra-frame prediction modes performed according to the size of each block is set to satisfy the relationship of A3≤A2≤A1. That is, when the current picture is roughly divided into blocks with a small size, blocks with a medium size, and blocks with a large size, preferably, the blocks with a medium size are set to have the largest number of prediction modes, and the blocks with a small size and the blocks with a large size are set to have a relatively small number of prediction modes. However, the present exemplary embodiment is not limited thereto, and the blocks with a small size and the blocks with a large size may be set to have a large number of prediction modes. Figure 2 The change in the number of prediction modes according to the size of each block shown in FIG. 1 is an example and may be changed.

[0048] Figure 3 is a diagram for explaining an intra prediction mode applied to a block having a predetermined size according to an exemplary embodiment.

[0049] Reference Figure 2 and Figure 3 , when intra prediction is performed on a block having a size of 4×4, the block having a size of 4×4 may have a vertical mode (mode 0), a horizontal mode (mode 1), a direct current (DC) mode (mode 2), a diagonal lower left mode (mode 3), a diagonal lower right mode (mode 4), a vertical right mode (mode 5), a horizontal downward mode (mode 6), a vertical left mode (mode 7), and a horizontal upward mode (mode 8).

[0050] Figure 4 is a diagram showing a method according to an exemplary embodiment Figure 3 An illustration of the direction of the intra prediction mode. Figure 4 , the numbers shown at the ends of the arrows represent the corresponding mode values ​​when prediction is performed in the direction marked by the arrows. Here, mode 2 is a DC prediction mode that has no directionality and is therefore not shown.

[0051] Figure 5 is used to explain the Figure 3 Schematic diagram of the intra-frame prediction method performed by the block shown in .

[0052] Reference Figure 5, in the available intra prediction mode determined by the size of the block, a prediction block is generated by using the neighboring pixels AM of the current block. For example, Figure 3 The operation of predictively encoding a current block of size 4×4 in mode 0 (i.e., vertical mode) of FIG. 1 is performed. First, the pixel values ​​of pixels A to D adjacent to the current block of size 4×4 above are predicted as the pixel values ​​of the current block of size 4×4. That is, the pixel value of pixel A is predicted as the pixel value of four pixels included in the first column of the current block of size 4×4, the pixel value of pixel B is predicted as the pixel value of four pixels included in the second column of the current block of size 4×4, the pixel value of pixel C is predicted as the pixel value of four pixels included in the third column of the current block of size 4×4, and the pixel value of pixel D is predicted as the pixel value of the fourth pixel included in the fourth column of the current block of size 4×4. Next, the residual between the actual pixel values ​​of the pixels included in the original 4×4 current block and the pixel values ​​of the pixels included in the 4×4 current block predicted by using pixels A to D is obtained and encoded.

[0053] Figure 6 is a diagram for explaining an intra prediction mode applied to a block having a predetermined size according to another exemplary embodiment.

[0054] Reference Figure 2 and Figure 6 When intra prediction is performed on a block having a size of 2×2 or 128×128, the block having a size of 2×2 or 128×128 can have 5 modes: a vertical mode, a horizontal mode, a DC mode, a plane mode, and a diagonal bottom-right mode.

[0055] At the same time, if Figure 2 As shown in FIG. 1 , a block of size 32×32 includes 33 intra prediction modes, and the directions of these 33 intra prediction modes need to be set. Figure 4 and Figure 6 Intra-prediction modes with various directions other than the intra-prediction modes shown in , the prediction direction for selecting neighboring pixels to be used as reference pixels with respect to the pixels in the block is set by using a (dx, dy) parameter. For example, when each of the 33 prediction modes is represented as mode N (N is an integer from 0 to 32), mode 0 can be set to a vertical mode, mode 1 can be set to a horizontal mode, mode 2 can be set to a DC mode, mode 3 can be set to a planar mode, and each of modes 4 to 32 can be set to a tan with a directionality represented by one of the following (dx, dy) -1The prediction mode of (dy / dx), where (dx,dy) is represented as (1,-1), (1,1), (1,2), (2,1), (1,-2), (2,1), (1,-2), (2,-1), (2,-11), (5,-7), (10,-7), (11,3), (4,3), (1,11), (1,-1), (12,-3), (1,-11), (1,-7), (3,-10), (5,-6), (7,-6), (7,-4), (11,1), (6,1), (8,3), (5,3), (5,7), (2,7), (5,-1) and (4,-3) as shown in Table 1.

[0056] [Table 1]

[0057]

[0058] The final mode 32 can be set to a bilinear mode using bilinear interpolation, which will be referred to later. Fig.10 describe.

[0059] Figure 7 is a reference diagram for explaining intra prediction modes having various directionality according to an exemplary embodiment.

[0060] As described with reference to Table 1, the intra prediction mode may have various directional properties by using a plurality of (dx, dy) parameters. -1 (dy / dx).

[0061] Reference Figure 7 , where the gradient is tan -1 Neighboring pixels A and B on the extended line 700 of (dy / dx) may be used as prediction factors of the current pixel P, wherein the gradient tan about the current pixel P to be predicted in the current block is determined according to (dx, dy) for each mode shown in Table 1. -1 (dy / dx). In this case, preferably, the neighboring pixels A and B used as prediction factors are pixels of the neighboring blocks that were previously encoded and restored above, on the left, above right, and below left of the current block. In addition, if the extension line 700 passes between neighboring pixels at integer positions, rather than passing through neighboring pixels at integer positions, neighboring pixels that are closer to the current pixel P among the neighboring pixels close to the extension line 700 may be used as prediction factors, or prediction may be performed by using the neighboring pixels close to the extension line 700. For example, an average value between neighboring pixels close to the extension line 700 or a weighted average value that takes into account the distance between the intersection of the connecting line between the extension line 700 and the neighboring pixels close to the extension line 700 and the neighboring pixels close to the extension line 700 may be used as a prediction factor for the current pixel P. In addition, as Figure 7As shown, a signal may be transmitted in block units, wherein neighboring pixels (eg, neighboring pixels A and B) among neighboring pixels on the X-axis and neighboring pixels on the Y-axis available according to a prediction direction are used as prediction factors of the current pixel P.

[0062] Figure 8 800 is a reference diagram for explaining a process of generating a prediction factor when an extended line 800 having a predetermined gradient passes between neighboring pixels at integer positions instead of passing through neighboring pixels at integer positions according to an exemplary embodiment.

[0063] Reference Figure 8 , if we have tan determined from (dx,dy) for each mode -1 If the extended line 800 of the angle (dy / dx) passes between the neighboring pixel A 810 and the neighboring pixel B 820 at the integer position, then as described above, the weighted average of the intersection of the extended line 800 and the connecting line between the neighboring pixel A 810 and the neighboring pixel B 820 close to the extended line 800 and the distance between the neighboring pixel A 810 and the neighboring pixel B 820 close to the extended line 800 may be used as the prediction factor of the current pixel P. For example, when the angle is tan -1 The distance between the intersection point of the extended line 800 of (dy / dx) and the adjacent pixel A 810 is f, and the angle is tan -1 When the distance between the intersection of the extended line 800 of (dy / dx) and the neighboring pixel B 820 is g, the prediction factor of the current pixel P can be obtained as (A×g+B×f) / (f+g). Here, preferably, f and g can both be normalized distances using integers. If software or hardware is used, the prediction factor of the current pixel P can be obtained by shift operation as (g×A+f×B+2)>>2. Figure 8 As shown, if the extended line 800 passes through the first quarter close to the neighboring pixel A 810 among the four parts obtained by quartering the distance between the neighboring pixel A 810 and the neighboring pixel B 820 at the integer position, the prediction factor of the current pixel P can be obtained as (3×A+B) / 4. Considering rounding to the nearest integer, such an operation can be performed by a shift operation, such as (3×A+B+2)>>2.

[0064] Fig. 9 is a reference diagram for explaining a process of generating a prediction factor when an extended line having a predetermined gradient passes between neighboring pixels at integer positions according to another exemplary embodiment.

[0065] Reference Fig. 9 , if we have tan determined from (dx,dy) for each mode -1If the extended line 800 of the angle (dy / dx) passes between the neighboring pixel A 910 and the neighboring pixel B 920 at integer positions, the portion between the neighboring pixel A 910 and the neighboring pixel B 920 may be divided into a predetermined number of regions, and a weighted average value considering the distance between the intersection point in each divided region and the neighboring pixel A 910 and the neighboring pixel B 920 may be used as a prediction value. For example, Fig. 9 As shown, the portion between the neighboring pixel A 910 and the neighboring pixel B 920 may be divided into five portions P1 to P5, and a representative weighted average value of the distances between the intersection point and the neighboring pixel A 151 and the neighboring pixel B 152 in each portion may be determined, and the representative weighted average value may be used as a prediction factor of the current pixel P. Specifically, if the extension line passes through portion P1, the value of the neighboring pixel A 910 may be determined as a prediction factor of the current pixel P. If the extension line passes through portion P2, a weighted average value (3×A+1×B+2)>>2 of the distances between the neighboring pixel A 910 and the neighboring pixel B 920 and the midpoint of portion P2 may be determined as a prediction factor of the current pixel P. If the extension line passes through portion P3, a weighted average value (2×A+2×B+2)>>2 of the distances between the neighboring pixel A 910 and the neighboring pixel B 920 and the midpoint of portion P3 may be determined as a prediction factor of the current pixel P. If the extension line passes through portion P4, a weighted average value (1×A+3×B+2)>>2 considering the distances between neighboring pixel A 910 and neighboring pixel B 920 and the midpoint of portion P4 may be determined as a prediction factor of the current pixel P. If the extension line passes through portion P5, the value of neighboring pixel B 920 may be determined as a prediction factor of the current pixel P.

[0066] In addition, if Figure 7 As shown, two neighboring pixels (i.e., neighboring pixel A on the upper side and neighboring pixel B on the left side) meet the extended line 700, and the average value of neighboring pixel A and neighboring pixel B may be used as a prediction factor for the current pixel P. Alternatively, if (dx×dy) is a positive value, the neighboring pixel A on the upper side may be used, and if (dx×dy) is a negative value, the neighboring pixel B on the left side may be used.

[0067] Preferably, intra-frame prediction modes with various directivities as shown in Table 1 may be pre-set at the encoding end and the decoding end, and only the corresponding index of the intra-frame prediction mode set for each block is sent.

[0068] Fig.10 is a reference diagram for explaining a bilinear mode according to an exemplary embodiment.

[0069] Reference Fig.10, in the bilinear mode, a geometric mean value considering the distances of the current pixel P from the upper, lower, left, and right boundaries of the current pixel P and pixels located at the upper, lower, left, and right boundaries of the current pixel P to be predicted in the current block is calculated, and the result of the calculation is used as a prediction factor of the current pixel P. That is, in the bilinear mode, the distances of the current pixel P from the upper, lower, left, and right boundaries of the current pixel P and the geometric mean values ​​of the pixels A 1061, B 1002, D 1006, and E 1007 located at the upper, lower, left, and right boundaries of the current pixel P may be used as a prediction factor of the current pixel P 1060. In this case, since the bilinear mode is one of the intra prediction modes, neighboring pixels on the upper and left sides that were previously encoded and restored should also be used as reference pixels during prediction. Therefore, corresponding pixel values ​​in the current block are not used as pixel A 1061 and pixel B 1002, but virtual pixel values ​​generated by using neighboring pixels on the top and sides are used.

[0070] Specifically, as shown in Equation 1, a virtual pixel C 1003 at the lower right of the current block is calculated by using an average value of an upper right neighboring pixel RightUpPixel 1004 and a lower left neighboring pixel LeftDowPixel 1005 adjacent to the current block.

[0071] math Figure 1

[0072] [Mathematics.1]

[0073] C = 0.5 (DownPixel + UpPixel)

[0074] Equation 1 can be calculated by shift operation as

[0075] C=0.5(DownPixel+UpPixel+1)>>1.

[0076] When the current pixel P 1060 is extended downward by considering the distance W1 from the left boundary of the current pixel P 1060 and the distance W2 from the right boundary of the current pixel P 1060, the value of the virtual pixel A 1061 located on the lower boundary may be set by using the average value of the neighboring pixel LeftDownPixel 1005 and the pixel C 1003 at the lower left. For example, the value of the pixel A 1061 may be calculated by using one equation shown in Equation 2.

[0077] math Figure 2

[0078] [Mathematics.2]

[0079] A=(C×W1+DownPixel×W2) / (W1+W2);

[0080] A=(C×W1+DownPixel×W2+((W1+W2) / 2)) / (W1+W2)

[0081] In Equation 2, when the value of W1+W2 is a power of 2, such as 2^n, A=(C×W1+DownPixel×W2+((W1+W2) / 2)) / (W1+W2) can be calculated as A=(C×W1+LeftDownPixel×W2+2^(n-1))>>n through a shift operation without the need for division.

[0082] Likewise, when the current pixel P 1060 is extended to the right by considering the distance h1 from the upper boundary of the current pixel P 1060 and the distance h2 from the lower boundary of the current pixel P 1060, the value of the virtual pixel B 1002 located on the right boundary can be set by using the average value of the pixel C 1003 and the neighboring pixel RightUpPixel 1004 at the upper right by considering the distances h1 and h2. For example, the value of the pixel B 1002 can be calculated by using one equation shown in Equation 3.

[0083] math Figure 3

[0084] [Mathematics.3]

[0085] B=(C×h1+UpPixel×h2) / (h1+h2);

[0086] B=(C×h1+UpPixel×h2+((h1+h2) / 2)) / (h1+h2)

[0087] In Equation 3, when the value of h1+h2 is a power of 2, such as 2^m, B=(C×h1+UpPixel×h2+((h1+h2) / 2)) / (h1+h2) can be calculated as B=(C×h1+UpPixel×h2+2^(m-1))>>m through a shift operation without the need for division.

[0088] Once the value of the virtual pixel A 1061 on the lower boundary of the current pixel P 1060 and the value of the virtual pixel B 1002 on the right boundary of the current pixel P 1060 are determined by using Equations 1 to 3, the prediction factor of the current pixel P 1060 may be determined by using the average value of A+B+D+E. Specifically, a weighted average value considering the distances between the current pixel P 1060 and the virtual pixel A 1061, the virtual pixel B 1002, the pixel D 1006, and the pixel E 1007 or the average value of A+B+D+E may be used as the prediction factor of the current pixel P 1060. For example, if Fig.10 The size of the block is 16×16 and using the average value of the addition, the prediction factor of the current pixel P 1060 can be obtained as (h1×A+h2×D+W1×B+W2×E+16)>>5. In this way, such bilinear prediction is applied to all pixels in the current block, generating a prediction block of the current block in bilinear prediction mode.

[0089] Since prediction encoding is performed according to an intra prediction mode which is changed according to the size of a block, more efficient compression can be achieved according to the characteristics of an image.

[0090] At the same time, since a greater number of intra-frame prediction modes than those used in conventional codecs are used according to the present exemplary embodiment, compatibility with conventional codecs may become a problem. Therefore, it may be necessary to map available intra-frame prediction modes having various directions to one of a smaller number of intra-frame prediction modes. That is, when the number of available intra-frame prediction modes of the current block is N1 (N1 is an integer), in order to make the available intra-frame prediction mode of the current block compatible with a block having N2 (N2 is an integer different from N1) intra-frame prediction modes, the intra-frame prediction mode of the current block may be mapped to the intra-frame prediction mode having the most similar direction among the N2 intra-frame prediction modes. For example, assuming that, as shown in Table 1, a total of 33 intra-frame prediction modes are available in the current block, the intra-frame prediction mode finally applied to the current block is mode 14, that is, mode 14 having a directionality of tan -1 (3 / 4)≈36.87 (degrees) (dx, dy) = (4, 3). In this case, in order to match the intra prediction mode applied to the current block to Figure 4 Of the 9 intra prediction modes shown, mode 4 (lower right) having the most similar directivity to 36.87 (degrees) can be selected. That is, mode 14 in Table 1 can be mapped to Figure 4 Similarly, if the intra prediction mode applied to the current block is selected as mode 15 among the 33 available intra prediction modes in Table 1, that is, (dx, dy) = (1, 11), then since the directionality of the intra prediction mode applied to the current block is tan-1 (11 / 1)≈84.80(degrees), so the direction that is most similar to the direction of 84.80(degrees) Figure 4 Mode 0 (vertical) can be mapped to mode 15.

[0091] Meanwhile, in order to decode a block encoded by intra prediction, prediction mode information about which intra prediction mode the current block is encoded by is required. Therefore, when an image is encoded, information about the intra prediction mode of the current block is added to the bitstream. At this time, if the information about the intra prediction mode is added to the bitstream as it is for each block, the overhead increases, thereby reducing the compression efficiency. Therefore, the information about the intra prediction mode of the current block determined as a result of encoding the current block may not be sent as it is, but only the difference between the value of the actual prediction mode and the value of the intra prediction mode predicted from the neighboring block may be sent.

[0092] If intra prediction modes with various directions are used according to the present exemplary embodiment, the number of available prediction modes may be changed according to the size of the block. Therefore, in order to predict the intra prediction mode of the current block, the intra prediction modes of the neighboring blocks need to be mapped to the representative intra prediction mode. Here, preferably, the representative intra prediction mode may be a smaller number of intra prediction modes among the available intra prediction modes of the neighboring blocks, or may be a smaller number of intra prediction modes such as Fig.14 There are 9 intra prediction modes shown in .

[0093] Fig.11 is a diagram for explaining a process of generating a prediction value of an intra prediction mode of a current block according to an exemplary embodiment.

[0094] Reference Fig.11 , when the current block is A 110, the intra prediction mode of the current block A 110 may be predicted from the intra prediction modes determined from the neighboring blocks. For example, if the intra prediction mode determined from the left block B 111 of the current block A 110 is mode 3, and the intra prediction mode determined from the upper block C 112 is mode 4, the intra prediction mode of the current block A 110 may be predicted as mode 3 having a smaller value among the prediction modes of the upper block C 112 and the left block B 111. If the intra prediction mode determined as a result of actual intra prediction encoding performed on the current block A 110 is mode 4, only a difference of 1 from mode 3, which is a value of the intra prediction mode predicted from the neighboring blocks B 111 and C 112, is transmitted as the intra prediction mode information. When the image is decoded, the prediction value of the intra prediction mode of the current block is generated in the same way, and the mode difference sent by the bit stream is added to the prediction value of the intra prediction mode to obtain the intra prediction mode information actually applied to the current block. Although only the neighboring blocks located above and to the left of the current block are used, other methods such as Fig.11 The other neighboring blocks E and D are shown to predict the intra prediction mode of the current block A 110.

[0095] At the same time, since the intra prediction mode actually performed varies according to the size of the block, the intra prediction mode predicted from the neighboring block may not match the intra prediction mode of the current block. Therefore, in order to predict the intra prediction mode of the current block from neighboring blocks with different sizes, it is necessary to unify the mapping process of the intra prediction modes of blocks with different intra prediction modes.

[0096] Fig.12 and Fig.13 is a reference diagram for explaining a mapping process for unifying intra prediction modes of blocks having different sizes according to an exemplary embodiment.

[0097] Reference Fig.12 , assuming that the size of the current block A 120 is 16×16, the size of the left block B 121 is 8×8, and the size of the upper block C 122 is 4×4. In addition, Figure 2 As shown in Example 1, it is assumed that the number of available intra prediction modes of blocks of sizes 4×4, 8×8, and 16×16 is 9, 9, and 33. In this case, since the number of available intra prediction modes of the left block B 121 and the upper block C 122 is different from that of the current block A 120, the intra prediction mode predicted from the left block B 121 and the upper block C 122 is not suitable for use as a prediction value of the intra prediction mode of the current block A 120. Therefore, in Fig.12 In FIG. 1 , the intra prediction modes of the left block B 121 and the upper block C 122 are respectively changed to Fig.14 The first representative intra prediction mode and the second representative intra prediction mode having the greatest similarity direction among the predetermined number of representative intra prediction modes shown, and a mode having a smaller mode value is selected from the first representative intra prediction mode and the second representative intra prediction mode as the final representative intra prediction mode. The intra prediction mode having the greatest similarity direction with the final representative intra prediction mode selected from the intra prediction modes available according to the size of the current block A 120 is predicted as the intra prediction mode of the current block A 120.

[0098] Optionally, refer to Fig.13 , assuming that the size of the current block A 130 is 16×16, the size of the left block B 133 is 32×32, and the size of the upper block C 132 is 8×8. In addition, Figure 2As shown in Example 1, it is assumed that the number of available intra prediction modes for blocks of sizes 8×8, 16×16, and 32×32 is 9, 9, and 32. In addition, it is assumed that the intra prediction mode of the left block B 133 is mode 4, and the intra prediction mode of the upper block C 132 is mode 31. In this case, since the intra prediction modes of the left block B 133 and the upper block C 132 are incompatible with each other, each of the intra prediction modes of the left block B 133 and the upper block C 132 is mapped to the following example: Fig.14 One of the representative intra prediction modes shown in FIG. Since the directionality of mode 31, which is the intra prediction mode of block B 133 on the left, is (dx, dy) = (4, -3) as shown in Table 1, mode 31 is mapped to Fig.14 The representative intra prediction modes have the same -1 (-3 / 4) is the most similar mode 5, since mode 4 has the same Fig.14 The block C 132 has the same directionality as mode 4 among the representative intra prediction modes, and thus mode 4 which is the intra prediction mode of the block C 132 above is mapped to mode 4.

[0099] Next, mode 4 having a smaller mode value among mode 5 of the mapped intra-frame prediction mode of block B 133 on the left and mode 4 of the mapped intra-frame prediction mode of block C132 on the upper side may be determined as the predicted value of the intra-frame prediction mode of the current block A 130, and only the mode difference between the actual intra-frame prediction mode of the current block A 130 and the predicted intra-frame prediction mode may be encoded as the prediction mode information of the current block A 130.

[0100] Fig.14 is a reference diagram for explaining a process of mapping an intra prediction mode of a neighboring block to one of representative intra prediction modes according to an exemplary embodiment. Fig.14 , vertical mode 0, horizontal mode 1, DC mode (not shown), diagonal lower left mode 3, diagonal lower right mode 4, vertical right mode 5, horizontal downward mode 6, vertical left mode 7, and horizontal upward mode 8 are set as representative intra prediction modes. However, the representative intra prediction modes are not limited thereto and may be set to have various directivities.

[0101] Reference Fig.14, a predetermined number of representative intra prediction modes are pre-set, and the intra prediction mode of the neighboring block is mapped to the representative intra prediction mode with the most similar direction. For example, if the determined intra prediction mode of the neighboring block is the intra prediction mode MODE_A 140 with directionality, the intra prediction mode MODE_A 140 of the neighboring block is mapped to the mode 1 with the most similar direction among the 9 preset representative intra prediction modes 1 to 9. If the determined intra prediction mode of the neighboring block is the intra prediction mode MODE_B 141 with directionality, the intra prediction mode MODE_B 141 of the neighboring block is mapped to the mode 5 with the most similar direction among the 9 preset representative intra prediction modes 1 to 9.

[0102] In this way, if the available intra-frame prediction modes of the neighboring blocks are different, the intra-frame prediction modes of the neighboring blocks are mapped to the representative intra-frame prediction modes, and the intra-frame prediction mode with the smallest mode value is selected as the final representative intra-frame prediction mode of the neighboring blocks from the mapped intra-frame prediction modes of the neighboring blocks. In this way, the reason why the representative intra-frame prediction mode has a smaller mode value is that the smaller mode value is set to a prediction mode that is generated more frequently. That is, if different intra-frame prediction modes are predicted from neighboring blocks, since the intra-frame prediction mode with a smaller mode value has a higher probability of occurrence, when there are different prediction modes, the prediction mode with a smaller mode value is preferably selected as the prediction factor of the prediction mode of the current block.

[0103] Sometimes, although a representative intra prediction mode is selected from a neighboring block, the representative intra prediction mode cannot be used as a prediction factor of the intra prediction mode of the current block as it is. Fig.12 As described, the current block A 120 has 33 intra prediction modes, and the representative intra prediction mode has only 9 representative intra prediction modes, then the intra prediction mode of the current block A 120 corresponding to the representative intra prediction mode does not exist. In this case, in a manner similar to the manner in which the intra prediction modes of the neighboring blocks are mapped to the representative intra prediction mode as described above, the intra prediction mode having the most similar direction to the representative intra prediction mode selected from the available intra prediction modes according to the size of the current block may be selected as a predictor of the final intra prediction mode of the current block. For example, if Fig.14 If the representative intra prediction mode finally selected from the neighboring blocks is mode 6, the intra prediction mode having a directionality most similar to that of mode 6 among the available intra prediction modes according to the size of the current block may be finally selected as the predictor of the intra prediction mode of the current block.

[0104] At the same time, as reference Figure 7As described above, if the prediction factor of the current pixel P is generated by using the neighboring pixels on or close to the extended line 700, the extended line 700 actually has a directional tan -1 (dy / dx). Since the division (dy / dx) is required to calculate the directionality, when hardware or software is used, the calculation is performed to decimal places, thereby increasing the amount of calculation. Therefore, preferably, when the prediction direction for selecting the neighboring pixel to be used as the reference pixel with respect to the pixel in the block is set by using the (dx, dy) parameter in a manner similar to that described with reference to Table 1, dx and dy are set to reduce the amount of calculation.

[0105] Fig.15 dx, dy) is a diagram for explaining a relationship between a current pixel and neighboring pixels located on an extended line having a directivity of (dx, dy) according to an exemplary embodiment.

[0106] Reference Fig.15 , assuming that the position of the current pixel P 1510 located at the i-th position (i is an integer) based on the upper boundary of the current block and the j-th position (j is an integer) based on the left boundary of the current block is P(j,i), and that the pixel P 1510 passing through the current pixel P 1510 and having a directionality (i.e., gradient) of tan -1 The upper neighboring pixel and the left neighboring pixel on the extended line of (dy / dx) are A 1520 and B 1530, respectively. In addition, when it is assumed that the position of the upper neighboring pixel corresponds to the X axis on the coordinate plane and the position of the left neighboring pixel corresponds to the Y axis on the coordinate plane, it is found by using the trigonometric function ratio that the upper neighboring pixel A 1520 that meets the extended line is located at (j+i×dx / dy, 0) and the left neighboring pixel B 1530 that meets the extended line is located at (0, i+j×dy / dx). Therefore, in order to determine any one of the upper neighboring pixel A 1520 and the left neighboring pixel B 1530 for predicting the current pixel P 1510, a division such as dx / dy or dy / dx is required. Since the division is very complicated as described above, the calculation speed of software or hardware is reduced.

[0107] Therefore, a value of at least one of dx and dy representing directionality of a prediction mode of neighboring pixels determined for intra prediction may be determined as a power of 2. That is, when n and m are integers, dx and dy may be 2^n and 2^m, respectively.

[0108] Reference Fig.15, if the left neighboring pixel B 1530 is used as a prediction factor for the current pixel P 1510, and dx has a value of 2^n, then j×dy / dx required to determine (0,i+j×dy / dx) (i.e., the position of the left neighboring pixel B 1530) becomes (i×dy) / (2^n), and the division using such a power of 2 can be easily obtained as (i×dy)>>n through a shift operation, thereby reducing the amount of calculation.

[0109] Similarly, if the upper neighboring pixel A1520 is used as a prediction factor for the current pixel P 1510, and dy has a value of 2^m, then i×dx / dy required to determine (j+i×dx / dy,0) (i.e., the position of the upper neighboring pixel A 1520) becomes (i×dx) / (2^m), which can be easily obtained as (i×dx)>>m by a shift operation using such a power of 2 division, thereby reducing the amount of calculation.

[0110] Fig.16 2 is a diagram for explaining that neighboring pixels located on an extended line having a directivity of (dx, dy) are changed according to a position of a current pixel according to an exemplary embodiment.

[0111] According to the position of the current pixel and the gradient of the extension line, one of the upper neighboring pixel and the left neighboring pixel located on the extension line passing through the current pixel is selected as the neighboring pixel required for prediction.

[0112] Reference Fig.16 , when the current pixel 1610 is P(j,i), and is predicted by using neighboring pixels located on the extended line having a gradient, the upper pixel A is used to predict the current pixel P 1610. When the current pixel 1620 is Q(b,a), the left pixel B is used to predict the current pixel Q 1620.

[0113] If only the dy component in the Y-axis direction of (dx, dy) representing the prediction direction has a power of 2, such as 2^m, it can be converted to Fig.16 The upper pixel A in is determined as (j+(i×dx)>>m,0) and does not need division, but the left pixel B needs division, as shown in (0,a+b×2^m / dx). Therefore, in order to exclude division when generating prediction factors for all pixels of the current block, all dx and dy should have a power of 2 type.

[0114] Fig.17 and Fig.18 is a diagram for explaining a method of determining an intra prediction mode direction according to an exemplary embodiment.

[0115] Generally, there are many cases where the linear pattern displayed in an image or video signal is vertical or horizontal. Therefore, when defining intra prediction modes with various directivities by using (dx, dy) parameters, image coding efficiency can be improved by defining the values ​​of dx and dy. For example, the absolute values ​​of dx and dy are set so that the distance between prediction directions close to the horizontal direction or the vertical direction is narrow, and the distance between prediction directions close to the diagonal direction is wide.

[0116] Specifically, refer to Fig.17 , if dy has a fixed value of 2^n, the absolute value of dx may be set so that the distance between the prediction directions close to the vertical direction is narrow, and the distance between the prediction directions closer to the horizontal direction is wider. In other words, the absolute value of dx may be set so that the distance between the prediction directions close to the vertical direction is narrow, and the distance between the prediction directions closer to the diagonal (+45 or -45 degrees) direction is wider. That is, if the fixed value of dy is a power of 2, the distance between the extended lines may be set to decrease as the absolute value of dx is closer to 0, so that the distance between the extended lines decreases as the direction of the extended lines is closer to the vertical direction, and the distance between the extended lines may be set to increase as the absolute value of dx is further away from 0, so that the distance between the extended lines increases as the direction of the extended lines is closer to the horizontal direction. For example, as Fig.17 As shown, if dy has a value of 2^4, i.e., 16, the value of dx can be set to 1, 2, 3, 4, 6, 9, 12, 16, 0, -1, -2, -3, -4, -6, -9, -12, and -16, so that the distance between the extension lines close to the vertical direction can be narrow, and the distance between the extension lines close to the horizontal direction can be wide.

[0117] Similarly, when dx has a fixed value of 2^n, the absolute value of dy can be set so that the distance between the prediction directions close to the horizontal direction is narrow, and the distance between the prediction directions closer to the vertical direction is wider. In other words, the absolute value of dy can be set so that the distance between the prediction directions close to the horizontal direction is narrow, and the distance between the prediction directions closer to the diagonal (+45 or -45 degrees) direction is wider. That is, if the fixed value of dx is a power of 2, the distance between the extended lines can be set to decrease as the absolute value of dy is closer to 0, so that the distance between the extended lines decreases as the direction of the extended lines is closer to the horizontal direction, and the distance between the extended lines can be set to increase as the absolute value of dy is farther away from 0, so that the distance between the extended lines increases as the direction of the extended lines is closer to the horizontal direction. For example, Fig.17As shown, if dx has a value of 2^4, i.e., 16, then the value of dy can be set to 1, 2, 3, 4, 6, 9, 12, 16, 0, -1, -2, -3, -4, -6, -9, -12, and -16, so that the distance between the extension lines close to the horizontal direction can be narrow, and the distance between the extension lines close to the vertical direction can be wide.

[0118] In addition, when the value of any one of dx and dy is fixed, the value of the remaining one can be set to increase according to the prediction mode. Specifically, when dy is fixed, the distance between dxs can be set to increase by a predetermined value. For example, if the value of dy is fixed to 16, then dx can be set so that the absolute value difference between different dxs (such as 0, 1, 3, 6, and 8) increases by 1. In addition, the angle between the horizontal direction and the vertical direction can be divided into predetermined units, and the increased amount can be set in each divided angle. For example, if dy is fixed, the value of dx can be set so that the increased amount in the part less than 15 degrees is "a", the increased amount in the part between 15 degrees and 30 degrees is "b", and the increased amount in the part greater than 30 degrees is "c". In this case, in order to have such a shape as shown, the value of dx can be set to satisfy the relationship a < b < c. Fig.17 As shown, the value of dx can be set to satisfy the relationship a < b < c.

[0119] By using (dx, dy) shown in Tables 2 to 4, the prediction mode described with reference to Figures 15 to 18 can be defined as a prediction mode with a direction of tan -1 (dy / dx).

[0120] Table 2

[0121] dx dy dx dy dx dy -32 32 21 32 32 13 -26 32 26 32 32 17 -21 32 32 32 32 21 -17 32 32 -26 32 26 -13 32 32 -21 32 32 -9 32 32 -17 -5 32 32 -13 -2 32 32 -9 0 32 32 -5 2 32 32 -2 5 32 32 0 9 32 32 2 13 32 32 5 17 32 32 9

[0122] Table 3

[0123]

[0124]

[0125] Table 4

[0126] dx dy dx dy dx dy -32 32 23 32 32 15 -27 32 27 32 32 19 -23 32 32 32 32 23 -19 32 32 -27 32 27 -15 32 32 -23 32 32 -11 32 32 -19 -7 32 32 -15 -3 32 32 -11 0 32 32 -7 3 32 32 -3 7 32 32 0 11 32 32 3 15 32 32 7 19 32 32 11

[0127] As referred to above Fig.15 As shown, the position of the current pixel P at the i-th position based on the upper boundary of the current block and the j-th position based on the left boundary of the current block is P(i, j), and the position of the current pixel P passing through the current pixel P and having a gradient of tan -1The upper neighboring pixel A and the left neighboring pixel B on the extended line of (dy / dx) are located at (j+i×dx / dy,0) and (0,i+j×dy / dx), respectively. Therefore, when intra prediction is performed by using software or hardware, calculations such as i×dx / dy or j×dy / dx are required.

[0128] When calculations like i×dx / dy are required, available values ​​dx / dy or C×dx / dy obtained by multiplying a predetermined constant C may be stored in a table, and the position of a neighboring pixel used for intra-prediction of a current pixel may be determined by using the values ​​stored in the table prepared in advance during actual intra-prediction. That is, various values ​​of (dx, dy) determined according to the prediction mode as shown in Table 1 and available values ​​i×dx / dy considering the value of I determined according to the size of the block may be pre-stored in a table and may be used during intra-prediction. Specifically, if C×dx / dy has N different values, these N different values ​​of C×dx / dy may be stored as dyval_table[n] (n=0…integer to N-1).

[0129] Likewise, when a calculation like j×dy / dx is required, available values ​​dy / dx or C×dy / dx obtained by multiplying a predetermined constant C may be stored in a table, and the position of a neighboring pixel for intra-prediction of a current pixel may be determined by using the values ​​stored in the table prepared in advance during actual intra-prediction. That is, various values ​​of (dx, dy) determined according to the prediction mode as shown in Table 1 and available values ​​j×dy / dx considering the value of j determined according to the size of the block may be pre-stored in a table and may be used for intra-prediction. Specifically, when C×dy / dx has N different values, these N different values ​​of C×dy / dx may be stored as dxval_table[n] (n=0...integer to N-1).

[0130] In this way, once the values ​​of C×dx / dy or C×dy / dx are pre-stored in a table, the position of the pixel of the neighboring block to be used to predict the current pixel can be determined by using the values ​​stored in the table corresponding to i×dx / dy and j×dy / dx without the need for additional calculations.

[0131] For example, suppose that in order to Fig.17The prediction mode is formed by a shape similar to the shape shown, dy is 32, dx is one of {0, 2, 5, 9, 13, 17, 21, 26, and 32}, and the constant C is 32. In this case, since C×dy / dx is 32×32 / dx and has one of values ​​{0, 512, 205, 114, 79, 60, 49, 39, and 32} according to the value of dx, the values ​​{0, 512, 205, 114, 79, 60, 49, 39, and 32} can be stored in the table and can be used for intra prediction.

[0132] Fig.19 is a flowchart illustrating a method of encoding an image through intra prediction according to an exemplary embodiment.

[0133] Reference Fig.19 In operation 1910, the current picture is divided into at least one block having a predetermined size. As described above, the current picture is not limited to a macroblock having a size of 16×16, and may be divided into blocks having a size of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, or a larger size.

[0134] In operation 1920, pixels of the neighboring blocks to be used for predicting each pixel in the current block are determined from pixels of the previously reconstructed neighboring blocks by using an extended line having a predetermined gradient. As described above, the position of the current pixel P located at the i-th position based on the upper boundary of the current block and the j-th position based on the left boundary of the current block is P(j,i), and the line passing through the current pixel P and having a gradient of tan -1 The upper neighboring pixel and the left neighboring pixel on the extended line of (dy / dx) are located at (j+i×dx / dy,0) and (0,i+j×dy / dx), respectively. In order to reduce the amount of calculation of dx / dy and dy / dx required to determine the position of the neighboring pixel, preferably, the value of at least one of dx and dy is a power of 2. In addition, if available values ​​dx / dy and dy / dx or values ​​obtained by multiplying the values ​​of dx / dy and dy / dx by a predetermined constant are pre-stored in a table, the pixels of the neighboring block can be determined by searching the corresponding values ​​in the table without additional calculation.

[0135] In operation 1930, each pixel in the current block is predicted by using the determined pixels of the neighboring blocks. That is, the pixel values ​​of the neighboring blocks are predicted as the pixel values ​​of the current block, and the prediction block of the current block is generated by repeatedly performing the above operation on each pixel value in the current block.

[0136] Fig. 20 is a block diagram illustrating an apparatus 2000 for decoding an image according to an exemplary embodiment.

[0137] Reference Fig. 20 , the device 2000 includes a parsing unit 2010, an entropy decoder unit 2020, an inverse quantization unit 2030, an inverse frequency transform unit 2040, an intra prediction unit 2050, a motion compensation unit 2060, a deblocking unit 2070, and a loop filtering unit 2080. Here, the intra prediction unit 2050 corresponds to a device for decoding an image through intra prediction.

[0138] The bit stream 2005 passes through the parsing unit 2010, and the encoding information required for decoding and the image data of the current block to be decoded are extracted. The encoded image data is output as inverse quantized data through the entropy decoding unit 2020 and the inverse quantization unit 2030, and is restored to a residual value through the inverse frequency transform unit 2040.

[0139] The motion compensation unit 2060 and the intra prediction unit 2050 generate a prediction block of the current block by using the parsed encoding information of the current block. Specifically, the intra prediction unit 2050 determines the pixels of the neighboring blocks to be used for predicting each pixel in the current block among the pixels of the previously reconstructed neighboring blocks by using an extended line with a predetermined gradient determined according to the intra prediction mode included in the bitstream. As described above, in order to reduce the amount of calculation of dx / dy and dy / dx required to determine the position of the neighboring pixels, preferably, at least one of dx and dy has a value that is a power of 2. In addition, the intra prediction unit 2050 may pre-store available values ​​dx / dy and dy / dx or values ​​obtained by multiplying the values ​​of dx / dy and dy / dx by a predetermined constant in a table, determine the pixels of the neighboring blocks by searching the corresponding values ​​in the table, and perform intra prediction by using the determined pixels of the neighboring blocks.

[0140] The prediction block generated in the motion compensation unit 2060 or the intra prediction unit 2050 is added to the residual value to restore the current frame 2095. The restored current frame may be used as a reference frame 2085 of a next block through the deblocking unit 2070 and the loop filtering unit 2080.

[0141] Fig.21 is a flowchart illustrating a method of decoding an image through intra prediction according to an exemplary embodiment.

[0142] Reference Fig.21 , in operation 2110, the current picture is divided into at least one block having a predetermined size.

[0143] In operation 2120, intra prediction mode information applied to the current block to be decoded is extracted from the bitstream. The intra prediction mode information may be a mode difference value between an actual intra prediction mode and an intra prediction mode predicted from a neighboring block of the current block, or may be a mode value of an intra prediction mode having various directionalities defined by using (dx, dy) parameters as described above. If the mode difference value is sent as the prediction mode information, the intra prediction unit 2050 may predict and determine a predicted intra prediction mode of the current block from the intra prediction modes of the previously decoded neighboring blocks, and determine the intra prediction mode of the current block by adding the mode difference value extracted from the bitstream to the mode value of the predicted intra prediction mode.

[0144] In operation 2130, the intra prediction unit 2050 determines, according to the extracted prediction mode, among the pixels of the previously reconstructed neighboring blocks, the pixels of the neighboring blocks to be used for predicting each pixel in the current block by using an extended line with a predetermined gradient. As described above, the position of the current pixel P located at the i-th position based on the upper boundary of the current block and the j-th position based on the left boundary of the current block is P(j,i), and the position passing through the current pixel P and having a gradient of tan -1 The upper neighboring pixel and the left neighboring pixel on the extended line of (dy / dx) are located at (j+i×dx / dy,0) and (0,i+j×dy / dx), respectively. In order to reduce the amount of calculation of dx / dy and dy / dx required to determine the position of the neighboring pixels, preferably, the value of at least one of dx and dy is a power of 2. In addition, available values ​​dx / dy and dy / dx or values ​​obtained by multiplying the values ​​of dx / dy and dy / dx by a predetermined constant may be pre-stored in a table, and the pixels of the neighboring block may be determined by searching the corresponding values ​​in the table. The intra-frame prediction unit 2050 predicts the pixel values ​​of the determined neighboring blocks as the pixel values ​​of the current block, and generates a prediction block of the current block by repeatedly performing the above operation on each pixel in the current block.

[0145] The exemplary embodiments may be written as computer programs and may be implemented in general-purpose digital computers that use computer-readable recording media to execute programs. Computer-readable recording media include magnetic storage media (e.g., ROM, floppy disks, hard disks, etc.) and optical recording media (e.g., CD-ROMs or DVDs).

[0146] The device, encoder and decoder of the exemplary embodiments may include a bus connected to each unit of the device, at least one processor (e.g., a central processing unit, a microprocessor, etc.) connected to the bus for controlling the operation of the device to implement the above-mentioned functions and execute commands, and a memory connected to the bus for storing commands, received messages and generated messages.

[0147] Although the present invention has been specifically shown and described with reference to the preferred embodiments of the present invention, it will be understood by those skilled in the art that various changes in form and detail may be made thereto without departing from the spirit and scope of the present invention as defined by the claims. The preferred embodiments should be considered as being merely descriptive, not for the purpose of limitation. Therefore, the scope of the present invention is not limited by the detailed description of the present invention, but by the claims, and all differences within this scope will be considered to be included in the present invention.

Claims

1. A method for encoding a video, the method comprising: include: Determining one or two neighboring pixels located on the left side of the current block or on the upper side of the current block according to an intra prediction mode, wherein the intra prediction mode indicates a specific direction among a plurality of directions, wherein the specific direction is indicated by using a dx number in a horizontal direction and a fixed number 2^5 in a vertical direction, or by using a dy number in a vertical direction and a fixed number 2^5 in a horizontal direction, wherein dx and dy are integers; determining the positions of the one or two neighboring pixels located on the left side of the current block or on the upper side of the current block using a bitwise shift operation based on the position of the current pixel (j, i) and one of a dx number and a dy number indicating the specific direction, wherein j and i are integers; performing intra prediction on the current block using the one or two neighboring pixels and positions of the one or two neighboring pixels to obtain a prediction value of a current pixel; Using the intra prediction value of the current block and the pixel value of the current block to obtain a residual; generating a bitstream including information about an intra prediction mode and information about a residual, wherein when one neighboring pixel is used, the prediction value of the current pixel is obtained based on the one neighboring pixel, and when two neighboring pixels are used, the prediction value of the current pixel is obtained based on a weighted average of the two neighboring pixels, wherein the weighted average is determined based on one of a dx number and a dy number and positions of the two neighboring pixels, The positions of the one or two neighboring pixels located on the upper side of the current block are determined based on i*dx>>5, where i is the position of the current pixel in the vertical direction, dx is the dx number in the horizontal direction, >> is a bitwise shift operation, wherein the position of the one or two neighboring pixels located on the left side of the current block is determined based on j*dy>>5, wherein j is the position of the current pixel in the horizontal direction, dy is the dy number in the vertical direction, and The bitwise shift operation is performed on the binary representation of i*dx and j*dy.

2. A computer-readable storage medium storing a bit stream, wherein the bit stream is encoded by an image encoding device using an image encoding method, wherein the image encoding method include: Determining one or two neighboring pixels located on the left side of the current block or on the upper side of the current block according to an intra prediction mode, wherein the intra prediction mode indicates a specific direction among a plurality of directions, wherein the specific direction is indicated by using a dx number in a horizontal direction and a fixed number 2^5 in a vertical direction, or by using a dy number in a vertical direction and a fixed number 2^5 in a horizontal direction, wherein dx and dy are integers; determining the positions of the one or two neighboring pixels located on the left side of the current block or on the upper side of the current block using a bitwise shift operation based on the position of the current pixel (j, i) and one of a dx number and a dy number indicating the specific direction, wherein j and i are integers; performing intra prediction on the current block using the one or two neighboring pixels and positions of the one or two neighboring pixels to obtain a prediction value of a current pixel; Using the intra prediction value of the current block and the pixel value of the current block to obtain a residual; generating a bitstream including information about an intra prediction mode and information about a residual, wherein when one neighboring pixel is used, the prediction value of the current pixel is obtained based on the one neighboring pixel, and when two neighboring pixels are used, the prediction value of the current pixel is obtained based on a weighted average of the two neighboring pixels, wherein the weighted average is determined based on one of a dx number and a dy number and positions of the two neighboring pixels, The positions of the one or two neighboring pixels located on the upper side of the current block are determined based on i*dx>>5, where i is the position of the current pixel in the vertical direction, dx is the dx number in the horizontal direction, >> is a bitwise shift operation, wherein the position of the one or two neighboring pixels located on the left side of the current block is determined based on j*dy>>5, wherein j is the position of the current pixel in the horizontal direction, dy is the dy number in the vertical direction, and The bitwise shift operation is performed on the binary representation of i*dx and j*dy.