(1) Field of the Invention
The present invention relates to an image coding apparatus and an image coding method for compression-coding images and recording the resulting images on a storage medium such as an optical disk, a magnetic disk, or a flash memory. The present invention particularly relates to an image coding apparatus, an image coding method, an image coding integrated circuit, and a camera for compression-coding images in accordance with the MPEG-4 AVC/H.264 (hereinafter abbreviated as H.264) compression-coding standard.
(2) Description of the Related Art
Along with advances of digital video technology, a technology for compression-coding digital video data is in the process of being developed to handle increasing amount of data. Such development can be seen in the form of a compression-coding technology that is specifically designed for handling video data by making use of video data characteristics.
Further, increased processing capacity of information processing appliances such as computers has enabled complex operations involved in the compression-coding technology, and resulted in significant increase in video data compression rate.
For example, the compression-coding technology adopted in satellite and terrestrial digital high-definition broadcasts is a compression-coding scheme known as Moving Picture Experts Group phase 2 (MPEG-2). For example, as for the satellite digital high-definition broadcast, video data is compressed to approximately one-thirtieth using MPEG-2.
The H.264 compression-coding standard, which is one of the video data compression-coding schemes standardized after MPEG-2, is said to achieve a compression rate approximately twice higher than that of MPEG-2.
H.264 is adopted also as a video data compression scheme for Blu-ray, which is a standard of optical disks, and for Advanced Video Codec High Definition (AVCHD), which is a standard for recording high-definition images using a camcorder. This shows the expectations for wide application of H.264.
H.264, however, involves a significantly increasing amount of operations compared to MPEG-2, because as disclosed in Non-Patent Reference 1 (ITU-T Recommendation H.264), H.264 achieves a high compression rate by implementing combinations of many compression techniques.
In compression-coding video data, the amount of information is generally compressed by reducing temporal and spatial redundancy. To be more specific, with inter-picture prediction coding which aims at reducing temporal redundancy, an amount of motion (motion vector) is detected on a block-by-block (macroblock-by-macroblock) basis by referring to a preceding or following picture, and prediction is performed with the detected motion vector taken into account, so that the prediction accuracy increases and thus the coding efficiency improves.
For example, the amount of information necessary for coding is reduced by detecting a motion vector of a current picture to be coded and coding the difference between a predicted value which is a value shifted by the amount indicated by the motion vector and a predicted value of the current picture to be coded.
When coding is performed using a motion vector, the motion vector is also coded and recorded or transmitted, because information of the motion vector is necessary for decoding. Here, a picture referred to at the time of detecting a motion vector is called a reference picture. Further, a picture is a term indicating one picture plane.
The motion vector is detected on a block-by-block basis. More specifically, while a block of a current picture to be coded (block to be coded) is fixed, a block of a reference picture (reference block) is shifted within a search range. The motion vector is then detected by finding the position of the reference block that most strongly resembles the block to be coded.
This processing of searching for a motion vector is called motion vector detection. The determination as to the block resemblance is generally performed using an error between the block to be coded and the reference block. In particular, a summed absolute difference (SAD) is often used.
Since searching for a reference block within an entire reference picture results in a great amount of operations, it is a general practice to limit the range for the search within the reference picture. The limited range is called a search range.
Further, pictures coded without inter-picture prediction but coded by only using intra-picture prediction, which is aimed at reducing the spatial redundancy, are called I-pictures; pictures coded using inter-picture prediction with reference to one reference picture are called P-pictures; and pictures coded using inter-picture prediction with reference to a maximum of two reference pictures are called B-pictures.
It is to be noted that B-pictures can refer to any combination of two pictures; a first reference picture is called a reference picture in L0 prediction, and a second reference picture is called a reference picture in L1 prediction.
According to the H.264 compression-coding standard, a reference picture can be selected from among plural previously coded pictures. Each reference picture selected is managed with a variable called reference index, which is coded at the time of coding a motion vector, as information indicating which picture is pointed to by the motion vector.
The reference index takes a value equal to or greater than 0, and as the value decreases, so does the amount of information after being coded (coded amount). Further, the setting of the reference index assignment to each reference picture can be freely made. Thus, it is possible to enhance the coding efficiency by assigning a reference index of a smaller number to a reference picture which many motion vectors point to.
For example, according to Context-based Adaptive Binary Arithmetic Coding (CABAC), which is a type of arithmetic coding adopted by the H.264 compression-coding standard, data to be coded is subject to binarization and arithmetic coding.
Thus, the reference index is also subject to binarization and arithmetic coding. Here, the code length after binarization (binary signal length) is three bits when the reference index is “2”, and two bits when the reference index is “1”. Further, the code length after binarization (binary signal length) is one bit when the reference index is “0”.
As can be understood, the binary signal length is shorter as the value of the reference index is smaller. Therefore, the eventual coded amount obtained by coding the reference index also tends to decrease as the value of the reference index decreases.
The reference index has been conventionally assigned using a method of assigning, to a reference picture having the same parity as that of the current picture to be coded, a reference index of a number smaller than that of a reference picture having a parity opposite to that of the current picture to be coded, for example.
This method is used in many camcorders having an image recording function in accordance with the H.264 compression-coding standard. Here, the reference picture having the same parity as that of the current picture to be coded is a reference picture that belongs to the same field as the current picture to be coded.
For example, when the current picture to be coded is a top field, a reference picture that belongs to a top field is the reference picture having the same parity.
On the other hand, the reference picture having a parity opposite to that of the current picture to be coded is a reference picture that belongs to a field different from the field of the current picture to be coded. For example, when the current picture to be coded is a top field, a reference picture that belongs to a bottom field is the reference picture having the opposite parity.
With reference to FIG. 15, a description is provided of a conventional method of reference index assignment in the case where a current picture is to be coded as a P-picture.
FIG. 15 shows an example of the conventional method of reference index assignment in the case where a current picture is to be coded as a P-picture.
In FIG. 15, a picture I0 is a picture to be coded as an I-picture, pictures P1, P6, and P7 are pictures to be coded as P-pictures, and pictures B2, B3, B4, and B5 are pictures to be coded as B-pictures. These pictures are illustrated in the order in which they are provided to an image coding apparatus 100.
It is to be noted that the arrows in the diagram show that the picture pointed to by an arrow (reaching point) can be referred to for coding the picture located at the base of the arrow (starting point).
When a current picture is to be coded as a P-picture (pictures P6 and P7 in FIG. 15), as shown in FIG. 15, for example, one picture is selected between the pictures I0 and P1 for each macroblock of the picture P6 as a reference picture of the picture P6.
Further, a reference index 0 (shown as RefIdx0 in FIG. 15) is assigned to the picture I0 having the same parity as that of the picture P6 that is the current picture to be coded. Furthermore, a reference index 1 (shown as RefIdx1 in FIG. 15) is assigned to the picture P1 having a parity opposite to that of the picture P6 that is the current picture to be coded.
Likewise, one picture is selected between the pictures P1 and P6 for each macroblock of the picture P7 as a reference picture of the picture P7. Further, the reference index 0 is assigned to the picture P1 having the same parity as that of the picture P7 that is the current picture to be coded, and the reference index 1 is assigned to the picture P6 having a parity opposite to that of the picture P7 that is the current picture to be coded.