An image coding apparatus compresses an amount of information generally using redundancy in a spatial direction and a temporal direction held by an image (including a still picture and video). Conversion into a frequency region is used as the method of using the redundancy in the spatial direction. Inter prediction is used as the method of using the redundancy in the temporal direction. The inter prediction is also called inter picture prediction.
When coding a picture, the image coding apparatus which employs the inter prediction uses, as a reference picture, a coded picture that precedes or follows, in display order, a current picture to be coded. Then the image coding apparatus derives a motion vector by motion estimation on the current picture with respect to the reference picture.
Next, the image coding apparatus obtains prediction image data by performing motion compensation based on the motion vector. Then, the image coding apparatus obtains a difference between the prediction image data and the image data of the current picture. Next, the image coding apparatus codes the obtained difference. With this, the image coding apparatus eliminates the redundancy in the temporal direction.
In the motion estimation, the image coding apparatus calculates a difference value between a current block to be coded in the current picture and a block in the reference picture, and determines, as a reference block, a block with the smallest difference value in the reference picture. Then, the image coding apparatus detects the motion vector, using the current block and the reference block.
An image coding apparatus according to a standardized image coding system (see Non Patent Literature (NPL) 1) called H.264 uses three picture types of I-picture, P-picture, and B-picture for compressing the amount of information. The image coding apparatus does not perform inter prediction on the I-picture. This means that the image coding apparatus performs intra prediction on the I-picture. The intra prediction is also called intra picture prediction.
In addition, the image coding apparatus performs inter prediction on the P-picture by referring to a coded picture that precedes or follows the current picture in display order. In addition, the image coding apparatus performs inter prediction on the B-picture by referring to two coded pictures that precede or follow the current picture in display order.
The motion vector used in coding is also used in decoding. Accordingly, information of the motion vector used in coding is stored in a bitstream that is output as a coded image. Then, image decoding processing is performed using the information on the motion vector included in the bitstream.
In addition, a structure for predicting a motion vector is employed in the image coding system of H.264 for compressing information of the motion vector. FIG. 39 is a diagram illustrating prediction of a motion vector. FIG. 39 indicates a current block to be coded and three adjacent blocks mbA, mbB, and mbC which are adjacent to the current block. Here, the three adjacent blocks mbA, mbB, and mbC are already coded.
A motion vector vA is a motion vector used in coding of the adjacent block mbA that is adjacent on the left to the current block. In addition, a motion vector vB is a motion vector used in coding of the adjacent block mbB that is adjacent on the upper side of the current block. In addition, a motion vector vC is a motion vector used in coding of the adjacent block mbC that is adjacent on the right to the current block.
It is predicted that the motion vector of the current block is a median value of the three motion vectors vA, vB, and vC. The motion vector obtained by the prediction is called a motion vector predictor and also called a prediction vector. The motion vector predictor illustrated in FIG. 39 is a median value of the three motion vectors vA, vB, and vC, and predicted for the current block.
In addition, a motion vector my illustrated in FIG. 39 is a motion vector derived from the motion estimation and used for coding the current block. The information of the motion vector my is compressed by subtracting the motion vector predictor from the motion vector my. The motion vector obtained by subtracting the motion vector predictor from the motion vector my is called a motion vector difference.
The information of the motion vector included in a bitstream resulting from coding is compressed as described above. Furthermore, in image decoding processing, the compressed motion vector is reconstructed using an equivalent prediction. More specifically, in the image decoding processing, the motion vector is reconstructed by adding together the motion vector difference included in a bitstream and the motion vector predictor resulting from prediction. With this, coding and decoding with high compression efficiency (also called coding efficiency) are implemented.