METHOD AND APPARATUS FOR ENCODING AND DECODING AN IMAGE USING A REFERENCE PICTURE
A method and apparatus for encoding and decoding an image by performing motion prediction and compensation on pictures in a group of pictures by selectively using a high-quality key picture that is previously encoded and restored, and a second picture that is previously encoded and restored. The method of encoding an image improves the prediction efficiency of an image by storing a key picture, which is encoded and restored to a high quality by reducing a loss caused by a quantization error using a small quantization coefficient, in a first storage unit and storing a previously encoded and restored second picture in a second storage unit, and then performing motion prediction and compensation by selectively using the key picture stored in the first storage unit and the second picture stored in the second storage unit while encoding a next picture in a group of pictures.
Latest Samsung Electronics Patents:
- PHOTORESIST COMPOSITIONS AND METHODS OF MANUFACTURING INTEGRATED CIRCUIT DEVICES USING THE SAME
- LENS DRIVING DEVICE AND CAMERA MODULE INCLUDING THE SAME
- ELECTRONIC SYSTEM AND METHOD OF MANAGING ERRORS OF THE SAME
- SEALING STRUCTURE AND MATERIAL CONTAINING DEVICE INCLUDING THE SAME
- STORAGE DEVICE, METHOD OF OPERATING STORAGE CONTROLLER, AND UFS SYSTEM
This application is a continuation of U.S. application Ser. No. 12/395,731 filed Mar. 2, 2009, which claims priority from Korean Patent Application No. 2008-0045481, filed on May 16, 2008, in the Korean Intellectual Property Office, the disclosures of which are incorporated herein by reference in their entireties.
BACKGROUND OF THE INVENTION1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to encoding and decoding an image, and more particularly, to a method and apparatus for encoding and decoding an image, which can improve prediction efficiency of an image by performing motion prediction and compensation on pictures in a group of pictures by selectively using a high-quality key picture that is previously encoded and then restored, and using a previous picture that is previously encoded and then restored.
2. Description of the Related Art
During video encoding, compression is performed by removing spatial redundancy and temporal redundancy in an image sequence. In order to remove temporal redundancy, an area of a reference picture that is similar to an area of a currently encoded picture is searched for by using a picture located in front of or behind the currently encoded picture as the reference picture, a motion vector between the area of the currently encoded picture and the corresponding area of the reference picture is detected, and a residual between the currently encoded picture and a prediction picture obtained by performing a motion compensation process is encoded based on the detected motion vector.
According to the video standards, such as Motion Picture Experts Group-1 (MPEG-1), MPEG-2, MPEG-4, and H.264/AVC (advance video coding), each picture in an image sequence is classified into an I picture, a P picture, or a B picture according to a prediction encoding method. An I picture denotes a picture that is encoded by using only information in the picture without performing prediction encoding between pictures; a P picture denotes a picture that is prediction encoded by referring to one picture that is located in front of or behind the currently encoded picture and is already processed; and a B picture denotes a picture that is prediction encoded by referring to two pictures that are located in front of or behind the currently encoded picture and that are already processed.
Generally, each picture in an image sequence is classified into a group of pictures (GOP) formed of a predetermined number of pictures. According to a coding order, the first picture in each GOP is encoded as an I picture, and the remaining pictures in each GOP are encoded as a P picture or a B picture. For example, when a GOP is formed of 7 pictures, the pictures may be encoded as IPPPPPP or IBBPBBP. In case of the pictures encoded as IPPPPPP, the first I picture is intra prediction encoded by using only information in the I picture without referring to any other picture. The remaining P pictures are encoded by using a temporarily adjacent previous picture that is previously encoded and then restored. In case of the pictures encoded as IBBPBBP, the B pictures between the I picture and the P picture are bi-directional prediction encoded by using two reference pictures of the first I picture and the fourth P picture, and the B pictures between the fourth P picture and the seventh P picture are bi-directional encoded by using two reference pictures of the fourth P picture and the seventh P picture.
When the pictures in the GOP are encoded as IPPPPPP or IBBPBBP, the overall bit rate may be reduced since a correlation between temporally adjacent images can be high, but a predication error may accumulate, thereby reducing an overall peak signal to noise ratio (PSNR).
SUMMARY OF THE INVENTIONThe present invention provides a method and apparatus for encoding and decoding an image, which can improve prediction efficiency of an image, by performing motion prediction and compensation by using not only a previously encoded and restored reference picture, but also a high-quality key picture as a reference picture, while encoding pictures in a group of pictures.
According to an aspect of the present invention, there is provided a method of encoding an image, the method comprising: encoding a first picture, restoring the first picture, and storing the first picture, from among pictures included in a group of pictures, in a first storage unit; prediction encoding a current picture by using the first picture stored in the first storage unit and a second picture previously encoded, restored, and stored in a second storage unit before the current picture is encoded; restoring the prediction-encoded current picture and storing the prediction-encoded current picture in the second storage unit; and prediction encoding a next picture that is to be encoded after the current picture using the prediction-encoded current picture stored in the second storage unit.
According to another aspect of the present invention, there is provided an apparatus for encoding an image, comprising: a first storage unit which stores a first picture that is encoded and restored to a high quality, from among pictures included in a group of pictures; a second storage unit which stores a previously encoded and restored second picture before a current picture is encoded; a prediction encoding unit which performs prediction encoding on the pictures included in the group of pictures; and a restoring unit which restores the prediction-encoded pictures, wherein the prediction encoding unit prediction encodes the current picture by using at least one of the first picture stored in the first storage unit and the second picture stored in the second storage unit, and restores and stores the prediction-encoded current picture in the second storage unit, and wherein the prediction-encoded current picture stored in the second storage unit is used to prediction-encode a next picture that is to be encoded after the current picture.
According to another aspect of the present invention, there is provided a method of decoding an image, comprising: decoding a first picture from among pictures included in an encoded group of pictures in a bitstream and storing the first picture in a first storage unit; decoding a current picture by using at least one of the first picture stored in the first storage unit and a second picture of the group of pictures, which is previously decoded and stored in a second storage unit; storing the decoded current picture in the second storage unit; and decoding a next picture that is to be decoded after the current picture is decoded using the decoded current picture stored in the second storage unit.
According to another aspect of the present invention, there is provided an apparatus for decoding an image, comprising: a first storage unit which stores a decoded first picture from among pictures included in an encoded group of pictures in a bitstream; a second storage unit which stores a previously decoded second picture of a the group of pictures; and a decoder which decodes a current picture by using at least one of the decoded first picture and the decoded second picture, wherein the decoder stores the decoded current picture in the second storage unit, and wherein the decoded current picture is used to decode a next picture that is to be decoded after the current picture is decoded.
The above and other features of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings in which:
Hereinafter, the present invention will be described more fully with reference to the accompanying drawings, in which exemplary embodiments of the invention are shown.
For example, one GOP is formed of 8 pictures. The first pictures 111 and 121 of the GOPs 110 and 120, respectively, may be encoded as I pictures, and the remaining pictures in the GOPs 110 and 120, that are excluding the I pictures, may be encoded as P pictures P1-P7 and P9-P15 of the GOPs 110 and 120, respectively, as illustrated in
The prediction encoding unit 210 includes a subtracter 201, an intra predictor 202, a motion predictor 203, a motion compensator 204, and a transformer and quantizer 205. The prediction encoding unit 210 divides an input image into blocks having a predetermined size, and generates a prediction block by performing inter prediction or intra prediction on each block. In detail, the motion predictor 203 performs motion prediction, to generate a motion vector that indicates an area similar to a current block within a predetermined search range of a reference picture that is previously encoded and then restored. The motion compensator 204 performs motion compensation to generate a prediction block of the current block by obtaining data about a corresponding area of a reference picture indicated by the generated motion vector. Specifically, the motion predictor 203, according to the current embodiment of the present invention, generates a first prediction block and a second prediction block of a block in a current picture by performing motion prediction and compensation using at least one of a first picture stored in a first storage unit 231 and a second picture stored in a second storage unit 232. Thus, the motion predictor 203 determines a prediction block having a lower error value with respect to the current block as the final prediction block. Details thereof will be described later.
The intra predictor 202 performs intra prediction to generate a prediction block by using data about blocks adjacent to the current block.
The subtracter 201 generates a residual by subtracting the prediction block of the current block from the original image data. The transformer and quantizer 205 transforms the residual to a frequency area, and quantizes the transformed residual. The transformer and quantizer 205, according to the current exemplary embodiment of the present invention, encodes a key picture, i.e., a first picture in each GOP, to a high quality by quantizing the residual using a quantization coefficient smaller than a predetermined quantization coefficient. For example, when a value of the preset quantization coefficient is QP, the transformer and quantizer 205 quantizes blocks in the key picture by using a quantization coefficient having a value that is 2 steps or 4 steps lower than the QP, such as QP-2 or QP-4. Accordingly, more bits are assigned to the key picture, thereby encoding the key picture to a high quality.
The entropy encoder 240 generates a bitstream by performing variable length encoding on the quantized image data.
The inverse transformer and inverse quantizer 220 restores residual data by performing inverse quantization and inverse transformation on the transformed and quantized residual data. The adder 225 restores the current block by adding the restored residual data and prediction data. The restored current block is stored in the storage unit 230 via the de-blocking filter 226, so as to be used as reference data of a next block.
The storage unit 230 includes the first storage unit 231, which stores the first picture, i.e., the key picture, and the second storage unit 232, which stores the second picture, i.e., a previous picture that is previously encoded and then restored, excluding the first picture. The first picture stored in the first storage unit 231 is a key picture that is quantized by using a lower quantization coefficient and then restored as described above, and is the first picture in a GOP. Since the first picture is quantized by using the lower quantization coefficient and then restored, a loss caused by a quantization error is reduced, and thus a high-quality image can be obtained.
Referring to
Referring to
Referring to
Then, when the P2 picture is encoded, the encoded and then restored I0 picture is stored in the first storage unit 231, and the P1 picture that is encoded and then restored before the P2 picture is stored in the second storage unit 232. As described above, when the P2 picture is encoded in a predetermined size block unit, the motion predictor 203 and the motion compensator 204 generate a first prediction block that is most similar to a current block of the P2 picture within a predetermined search range of the TO picture stored in the first storage unit 231, and generate a second prediction block that is most similar to the current block of the P2 picture within a predetermined search range of the P1 picture stored in the second storage unit 232. Then, the motion predictor 203 and the motion compensator 204 determine a prediction block having the smallest error value with respect to the current block of the P2 picture, from among the first and second prediction blocks, as the final prediction block. The transformer and quantizer 205 encodes a residual, i.e. a difference between the final prediction block and the current block of the P2 picture, by transforming and quantizing the residual. The inverse transformer and inverse quantizer 220 restores the residual of the P2 picture by performing inverse quantization and inverse transformation, and the adder 225 restores the current block of the P2 picture by adding the restored residual and the final prediction block. When the P2 picture is restored by encoding and restoring all blocks of the P2 picture as described above, the restored P2 picture is stored in the second storage unit 232 so as to be used as a reference picture of the next P3 picture. Similarly, P3 through P7 pictures are prediction encoded via a motion prediction and compensation process by using the TO picture, i.e. the key picture, stored in the first storage unit 231 and a previous picture that is encoded, restored, and then stored in the second storage unit 232.
When one GOP is completely encoded, the first and second storage units 231 and 232 are refreshed. In other words, when each GOP illustrated in
Meanwhile, if it is determined that the prediction block having the smaller error value with respect to the current block is the second prediction block, as the result of motion prediction and compensation, i.e. when it is determined that performing prediction encoding by using the second picture stored in the second storage unit 232 generates a smaller prediction error than the first picture stored in the first storage unit 231, the first picture may be updated by substituting an area of the first picture stored in the first storage unit 231 with the second prediction block, where the area of the first picture corresponds to the second prediction block.
Referring to
Referring to
In operation 720, in order to encode the remaining pictures in the GOP, a current picture is prediction encoded by using at least one of the first picture stored in the first storage unit, and a second picture is encoded, restored, and then stored in a second storage unit before the current picture. As described above, a motion predictor and a motion compensator generate a first prediction block from the first picture stored in the first storage unit, generate a second prediction block from the second picture stored in the second storage unit, and determine a prediction block having a lower error value with respect to the current block, from among the first and second prediction blocks, as a final prediction block of the current block, by performing motion prediction and compensation on the current block of the current picture. If the prediction block having a lower error value with respect to the current block is determined to be the second prediction block, the first storage unit updates the first picture by substituting an area of the first picture, which corresponds to the second prediction block of the second picture, with the second prediction block.
In operation 730, the prediction-encoded current picture is restored and stored in the second storage unit so that the current picture is used as the second picture of a picture to be encoded after the current picture.
Referring to
The entropy encoder 810 extracts prediction mode information, reference picture information, and residual information of the current block to be decoded, from an input bitstream. The predictor 820 generates a prediction block of the current block by using the extracted prediction mode information and reference picture information. In detail, when a prediction mode of the current block is an inter prediction mode, the predictor 820 determines a reference picture from among the first picture stored in the first storage unit 851 and the second picture stored in the second storage unit 852 by using the reference picture information, and generates the prediction block of the current block by performing motion compensation using the determined reference picture. Here, the first picture is a key picture that is initially decoded from among pictures included in each GOP, and the second picture is a previous picture that is decoded before the current picture.
The residual restorer 830 restores a residual in the bitstream by performing inverse quantization and inverse transformation on the residual. The adder 840 decodes the current block by adding the restored residual and the prediction block of the current block. When the reference picture is the second picture, the first storage unit 851 may update the first picture by substituting an area of the first picture, which corresponds to the prediction block, with the prediction block.
Referring to
In operation 920, at least one of the first picture and the second picture that is decoded and stored in a second storage unit before the current picture is determined as a reference picture of the current picture by using the reference picture information, and the current picture is decoded by performing motion compensation on each block of the current picture.
In operation 930, the decoded current picture is stored in the second storage unit so that the current picture is used as the second picture of a picture to be decoded after the current picture.
According to the method and apparatus for encoding an image of the present invention, prediction efficiency of a current picture is improved by using one of a key picture having a high quality and an adjacent previous picture that is previously encoded and then restored as a reference picture. Moreover, by improving the quality of the reference picture, the quality of images that are prediction encoded by using the reference picture also improves, and thus the compression performance of an image can be improved.
The invention can also be embodied as computer readable codes on a computer readable recording medium. The computer readable recording medium may be any data storage device that can store data, which can be thereafter read by a computer system. Examples of the computer readable recording medium include read-only memory (ROM), random-access memory (RAM), CD-ROMs, magnetic tapes, floppy disks, and optical data storage devices. In an alternative embodiment, the computer readable recording medium may be carrier waves (such as data transmission through the Internet). The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it will be understood by one of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present invention as defined by the following claims.
Claims
1. A method of decoding an image, comprising:
- decoding a first picture from among pictures included in an encoded group of pictures in a bitstream and storing the first picture in a first storage unit;
- decoding a second picture from among pictures included in an encoded group of pictures in the bitstream and storing the second picture in a second storage unit; and
- decoding a current picture by using at least one of the first picture stored in the first storage unit and the second picture of the group of pictures.
2. The method of claim 1, wherein the first picture is a key picture that is initially decoded from among the pictures included in the group of pictures.
3. The method of claim 1, wherein the decoding of the current picture comprises:
- extracting reference picture information of a current block of the current picture to be decoded from the bitstream;
- determining a reference picture from among the first and second pictures by using the reference picture information, and generating a prediction block of the current block by performing motion compensation using the determined reference picture; and
- decoding the current block by adding a residual in the bitstream and the prediction block of the current block.
4. An apparatus for decoding an image, comprising:
- a first storage unit which stores a decoded first picture from among pictures included in an encoded group of pictures in a bitstream;
- a second storage unit which stores a previously decoded second picture of the group of pictures; and
- a decoder which decodes a current picture by using at least one of the decoded first picture and the decoded second picture.
5. The apparatus of claim 4, wherein the first picture is a key picture that is initially decoded from among the pictures included in the group of pictures.
6. The apparatus of claim 4, wherein the decoder comprises:
- an entropy decoder which extracts reference picture information of a current block of the current picture to be decoded from the bitstream;
- a predictor which determines a reference picture from among the first and second pictures by using the reference picture information, and generates a prediction block of the current block by performing motion compensation using the determined reference picture;
- a residual restorer which restores a residual in the bitstream by inverse quantizing and inverse transforming the residual; and
- an adder which decodes the current block by adding the restored residual and the prediction block of the current block.
Type: Application
Filed: Jan 21, 2013
Publication Date: May 23, 2013
Applicant: SAMSUNG ELECTRONICS CO., LTD. (Gyeonggi-do)
Inventor: SAMSUNG ELECTRONICS CO., LTD. (Gyeonggi-do)
Application Number: 13/746,297