Image signal coding technology is used for the transmission and storage/playback of image signals of still images, moving images, and the like. A few international standardized coding schemes are already widely used such as CCITT Rec. T. 81 (JPEG) for still images coding, and ISO/IEC International Standard 14496-2 (MPEG-4 Visual) for moving images coding.
Also, a newer coding scheme, namely, ITU-T Rec. H. 264 Advanced Video Coding|ISO/IEC International Standard 14496-10 (MPEG-4 AVC) to be referred to as H. 264 hereinafter is a moving image coding scheme based on the joint international standardization of ITU-T and ISO/IEC.
In an image signal, spatially adjacent pixels have a large correlation. Therefore, when the signal is transformed into a frequency domain, information is locally distributed in a low-frequency region, and redundancy can be reduced by using this local distribution of information. In general image coding schemes, orthogonal transformations are performed to transform an image signal into orthogonal transformation coefficients in the frequency domain in order for signal components to be locally distributed in a low-frequency region. In addition, these coefficient values are quantized to set coefficients with small values to zero values. The coefficients are then sequentially read out, starting from the low-frequency region, to form a coefficient sequence. Then, entropy coding is performed using the local distribution of coefficient values to realize efficient coding with reduced redundancy.
In this case, to perform orthogonal transformations, the discrete cosine transform (DCT) is widely used for its coding efficiency and its ease of implementation. Orthogonal transformations such as DCT are performed for each block obtained by dividing an image signal each of them comprising a plurality of pixels.
If image signals undergo small changes in their spatial properties, image signals transformed into orthogonal transformation coefficients in similar frequency regions are widely distributed on the image. Increasing the size of each block, i.e., the size of an orthogonal transformation makes it possible to further reduce redundancy and improve coding efficiency as compared with a case wherein small blocks are used leading to similar and redundant orthogonal transformation coefficients. In contrast, if image signals undergo large changes in spatial properties, larger block sizes lead to a reduction in local distribution of coefficients each of them including various frequency components. This makes it difficult to perform efficient entropy coding, resulting in a decrease in coding efficiency.
According to H. 264, entropy coding for orthogonal transformation coefficients obtained by orthogonal transformation is performed with respect to a coefficient sequence obtained by sequentially reading out orthogonal transformation coefficients, starting from a high-frequency region. FIG. 1A shows the readout order of coefficients in a 4×4 pixel orthogonal transformation block. The coefficients obtained by orthogonal transformation are arranged with the lowest frequency component (i.e., a DC component) being located at the upper left position. Therefore, by sequentially reading out coefficients from an orthogonal transformation block like that shown in FIG. 1B, starting from the upper left position, a coefficient sequence comprising 16 coefficients like that shown in FIG. 1C is obtained. Such a readout order is referred to as a zigzag scan.
Correlation absence is set among coefficients obtained by orthogonal transformation, and signal components are locally distributed in a low-frequency region. If these coefficients are further quantized, coefficients in a low-frequency region tend to have non-zero coefficient values, and many coefficients with zero values appear in the coefficient sequence. For example, a row of coefficient values like that shown in FIG. 1C is obtained. In order to efficiently perform entropy coding for a coefficient sequence having such a distribution, image coding is generally performed by expressing the coefficient sequence using the number of consecutive zero coefficients (run) preceding each non-zero coefficient and the coefficient value (level) of each non-zero coefficient.
In order to further improve the efficiency of such entropy coding, H. 264 has adopted a technique called CAVLC (Context-based Adaptive Variable Length Code)(see Japanese Patent Application Laid-open No. 2004-134896).
According to CAVLC in H. 264, the coefficient sequence obtained from a 4×4 pixel orthogonal transformation block includes a maximum of 16 coefficients, and the runlength is limited by this maximum number. In addition, the level tends to increase going towards a lower frequency region. According these situations, many code tables, which are used for variable-length coding and optimized for the respective conditions, are prepared, and the coding efficiency is improved by sequentially switching and using them.
If, for example, the respective levels are sequentially coded from the right side (high frequency side) of the row of the coefficient values shown in FIG. 1C, many small values are generated on the right side, and larger values appear toward the left side (low frequency side). As shown in FIG. 3, a code table in which short code length vlcLength is assigned to each small level value is used at first. Code length vlcLength in this code table is relatively short, i.e., 14 bits or less, when the absolute value of a corresponding level is 7 or less. When the absolute value of a level is 8 or more, a code length of 19 bits is assigned. When the absolute value of a level is 16 or more, a code length of 28 bits is assigned. That is, the code length increases with an increase in level. As the levels coded from the right side of the row of the coefficient values shown in FIG. 1C exceed a predetermined threshold, code tables in which relatively short code lengths are assigned to even large level values as shown in FIGS. 3 to 9 are used. This makes it possible to efficiently perform entropy coding by assigning codes with a smaller number of bits.
Note that the variable-length codes of levels in CAVLC in H. 264 are comprised of prefix level_prefix_code shown in the code table in FIG. 2 and suffix level_suffix_code shown in the code tables in FIGS. 3 to 9 which is selected in accordance with suffix length suffixLength. The code tables in FIGS. 3 to 9 correspond to suffix length suffixLength of 0 to suffix length suffixLength of 6.
In the code tables in FIGS. 3 to 9, x represents the absolute value of a level, s represents the sign of the level, and each value takes 0 or 1. If, for example, suffix length suffixLength is 3, and the level is −11, prefix symbol level_prefix is 2, and suffix level_suffix_code is “101” according to FIG. 6. According to FIG. 2, when prefix symbol level_prefix is 2, prefix level_prefix_code is “001”. Therefore, the variable-length code corresponding to this level is “001101”.
Suffix length suffixLength is acquired on the basis of the value of a level which has already been coded. If the absolute value of the level exceeds the threshold corresponding to suffix length suffixLength in the table shown in FIG. 10, suffix length suffixLength of a subsequent variable-length code is increased by one. If the absolute value of the level does not exceed the threshold, suffix length suffixLength holds its value without change. The maximum value of suffix length suffixLength is 6.
For details regarding CAVLC, see H. 264.
A conventional variable-length code decoding apparatus which decodes a code corresponding to a level in CAVLC described above has, for example, the arrangement shown in FIG. 11.
Referring to FIG. 11, a bit stream buffer 500 is a buffer which temporarily stores the bit stream of input variable-length codes, and a variable-length code shifter unit 501 supplies a variable-length code to be decoded in the next clock cycle on the basis of code length vlcLength of the decoded variable-length code output from a level decoding unit 503. The supplied variable-length code delayed by a delay unit 502 is decoded by the level decoding unit 503.
The level decoding unit 503 decodes the level from the input variable-length code on the basis of suffix length suffixLength acquired in advance by a suffix length acquiring unit 504 and the code tables shown in FIGS. 3 to 9, and outputs the level value and code length vlcLength. The suffix length acquiring unit 504 compares the absolute value of the decoded level with a threshold corresponding to suffix length suffixLength shown in FIG. 10, and increases suffix length suffixLength by one if the absolute value exceeds the threshold. Note that the initial value of suffix length suffixLength is 0, and is initialized at the beginning of the decoding of an orthogonal transformation block.
However, in the conventional variable-length code decoding apparatus, the code length vlcLength necessary for supplying the next variable-length code cannot be known until the end of decoding by the level decoding unit 503. The level decoding unit 503 has an arrangement like that shown in FIG. 12. Suffix code tables 5032 to 5038 respectively comprise the code tables shown in FIGS. 3 to 9. If these tables are implemented as a system LSI circuit, a critical path from level decoding processing to code supplying processing (a loop from the output of the delay unit 502 to the input of the delay unit 502) increases in length. This makes it impossible to increase the operating frequency. If such a conventional variable-length code decoding apparatus is incorporated in a moving image decoding apparatus, the decoding processing speed of the variable-length code decoding apparatus becomes a bottleneck, resulting in the problem that the processing speed of moving image decoding cannot be increased.
This leads to the inconvenience of decreasing the image size and frame rate so as to allow real-time decoding.