The present invention relates to a decoding apparatus and its method for code streams of a still image or moving image and, more particularly, to a variable-length code decoding apparatus and its method which decode a variable-length code containing a prefix and a suffix.
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.
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
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
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
In the code tables in
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
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
Referring to
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
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
This leads to the inconvenience of decreasing the image size and frame rate so as to allow real-time decoding.
The present invention has been made to solve the above problems, and provides a variable-length code decoding technique for realizing high-speed decoding processing without decreasing an image size or frame rate.
A variable-length code decoding apparatus according to an aspect of the present invention decodes a variable-length code containing a prefix and a suffix and comprises a prefix decoding unit which decodes a prefix of an input variable-length code and outputs a symbol and prefix length corresponding to the prefix, a suffix shifter unit which supplies the suffix on the basis of the prefix length output from the prefix decoding unit, and a symbol decoding unit which decodes a symbol corresponding to a variable-length code on the basis of the symbol corresponding to the prefix which is output from the prefix decoding unit, the suffix supplied by the suffix shifter unit, and a suffix length acquired in advance.
A variable-length code decoding apparatus according to another aspect of the present invention decodes N adjacent variable-length codes each containing a prefix and a suffix and comprises N prefix decoding units which decode prefixes of input variable-length codes and output symbols and prefix lengths corresponding to the prefixes, N suffix shifter units which supply the suffixes on the basis of the prefix lengths output from the prefix decoding units, and N symbol decoding units which decode symbols corresponding to variable-length codes on the basis of the symbols corresponding to the prefixes which are output from the prefix decoding units, the suffixes supplied by the suffix shifter units, and the suffix lengths acquired on the basis of already decoded symbols.
Other features and advantages of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same or similar parts throughout the figures thereof.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
Preferred embodiments of the present invention will now be described in detail in accordance with the accompanying drawings.
The variable-length code decoding apparatus of this embodiment comprises a bit stream buffer 100, variable-length code shifter unit 101, prefix decoding unit 102, suffix shifter unit 103, code length acquiring unit 104, level decoding unit 105, suffix length acquiring unit 106, and delay units 107 and 108. The operation of the variable-length code decoding apparatus according to this embodiment will be described below with reference to
The bit stream buffer 100 is a buffer which temporarily stores the bit stream of input variable-length codes. On the basis of code length vlcLength of a variable-length code, which has already been coded, acquired by the code length acquiring unit 104 (to be described later), the variable-length code shifter unit 101 receives a variable-length code from the bit stream buffer 100 and supplies the next variable-length code. The variable-length code output from the variable-length code shifter unit 101 is delayed by the delay unit 107 by one cycle, and is input to the prefix decoding unit 102 and the suffix shifter unit 103.
The prefix decoding unit 102 obtains prefix symbol level_prefix and prefix length prefixLength from the variable-length code input from the delay unit 107 on the basis of the code table shown in
The code length acquiring unit 104 acquires code length vlcLength of the variable-length code comprising prefix level_prefix_code and suffix level_suffix_code from prefix length prefixLength input from the prefix decoding unit 102 and suffix length suffixLength output from the suffix length acquiring unit 106 (to be described later) and delayed by the delay unit 108 by one cycle in accordance with the flowchart shown in
In step S101, it is determined whether suffix length suffixLength is 0. If suffixLength is 0, the flow advances to step S102. In step S102, it is determined whether prefix symbol level_prefix is 14.
If it is determined in step S102 that prefix symbol level_prefix is 14, the flow advances to step S103 to determine that code length vlcLength is 19.
If it is determined in step S101 that suffix length suffixLength is not 0, or if it is determined in step S102 that prefix symbol level_prefix is not 14, the flow advances to step S104.
It is determined in step S104 whether prefix symbol level_prefix is 15. If it is determined that prefix symbol level_prefix is 15, the flow advances to step S105 to determine that code length vlcLength is 28.
If it is determined in step S104 that prefix symbol level_prefix is not 15, the flow advances to step S106 to perform control to make code length vlcLength equal to the sum of prefix length prefixLength and suffix length suffixLength.
Code length vlcLength acquired by the above operation is supplied to the variable-length code shifter unit 101. Note that in the flowchart of
The suffix shifter unit 103 supplies suffix level_suffix_code following prefix level_prefix_code from the variable-length code input from the delay unit 107 on the basis of prefix length prefixLength input from the prefix decoding unit 102. If, for example, the variable-length code input from the delay unit 107 is “001101 . . . ” and prefix length prefixLength input from the prefix decoding unit 102 is 3, the suffix shifter unit 103 discards the upper three bits and supplies suffix level_suffix_code “101 . . . ”.
The level decoding unit 105 decodes a level by using the code tables shown in
Note that the level decoding unit 105 includes the code tables shown in
The suffix length acquiring unit 106 determines whether the absolute value of a level decoded by the level decoding unit 105 exceeds a threshold corresponding to suffix length suffixLength written in the table shown in
Suffix length suffixLength acquired by the suffix length acquiring unit 106 is delayed by the delay unit 108 by one cycle, and is used for the decoding of a subsequent variable-length code.
As described above, in the variable-length code decoding apparatus of this embodiment, the code length acquiring unit 104 acquires code length vlcLength necessary for the variable-length code shifter unit 101 to supply a variable-length code on the basis of prefix length prefixLength output from the prefix decoding unit 102 and suffix length suffixLength acquired by the suffix length acquiring unit 106 in advance before one cycle. That is, a code length necessary for supplying is acquired before the completion of decoding by the level decoding unit 105. Therefore, the critical path of the circuit (the loop from the output of the delay unit 107 to the input of the delay unit 107) can be shortened, and the operating frequency can be increased. This makes it possible to increase the processing speed.
A variable-length code decoding apparatus according to the second embodiment of the present invention will be described next.
The variable-length code decoding apparatus of this embodiment comprises a bit stream buffer 200, first variable-length code shifter unit 201, first prefix decoding unit 203, first suffix shifter unit 204, first code length acquiring unit 205, first level decoding unit 206, second suffix length acquiring unit 207, second variable-length code shifter unit 208, second prefix decoding unit 209, second suffix shifter unit 210, second code length acquiring unit 211, second level decoding unit 212, first suffix length acquiring unit 213, total code length acquiring unit 215, delay unit 214, and delay unit 202. The operation of the variable-length code decoding apparatus of the embodiment will be described below with reference to
The bit stream buffer 200 is a buffer which temporarily stores the bit stream of input variable-length codes. On the basis of code lengths vlcLengths of two consecutive variable-length codes, which have already been coded, acquired by the total code length acquiring unit 215 (to be described later), the first variable-length code shifter unit 201 receives variable-length codes from the bit stream buffer and supplies the next two consecutive variable-length codes. Two consecutive variable-length codes vlc#1 and vlc#2 output from the first variable-length code shifter unit 201 are delayed by the delay unit 202 by one cycle, and are input to the first prefix decoding unit 203 and the first suffix shifter unit 204.
The operation of the variable-length code decoding apparatus of this embodiment will be described on the assumption that two consecutive variable-length codes vlc#1 and vlc#2 which are output from the first variable-length code shifter unit 201 and delayed by the delay unit 202 are “0001000101 . . . ”.
The first prefix decoding unit 203 obtains first prefix symbol level_prefix#1 and first prefix length prefixLength#1 from the variable-length codes input from the delay unit 202 on the basis of the code table shown in
The first code length acquiring unit 205 acquires code length vlcLength#1 (to be written as first code length vlcLength#1 hereinafter) of variable-length code vlc#1 comprising first prefix level_prefix_code#1 and first suffix level_suffix_code#1 according to the flowchart of
The first suffix shifter unit 204 supplies first suffix level_suffix_code #1 following first prefix level_prefix_code#1 from the variable-length codes input from the delay unit 202 on the basis of first prefix length prefixLength#1 input from the first prefix decoding unit 203. If, for example, the variable-length codes input from the delay unit 202 are “0001000101 . . . ” and first prefix length prefixLength#1 input from the first prefix decoding unit 203 is 4, the first suffix shifter unit 204 discards the upper four bits and supplies the code “000101 . . . ” containing first suffix level_suffix_code #1.
The first level decoding unit 206 decodes first level level#1 from first prefix symbol level_prefix#1 input from the first prefix decoding unit 203, first suffix level_suffix_code #1 supplied from the first suffix shifter unit 204, and first suffix length suffixLength#1 output from the first suffix length acquiring unit 213 (to be described later) and delayed by the delay unit 214 by one cycle on the basis of the code tables shown in
Note that the first level decoding unit 206 includes the code tables shown in
The second suffix length acquiring unit 207 determines whether the absolute value of first level level#1 decoded by the first level decoding unit 206 exceeds a threshold corresponding to suffix length suffixLength written in the table shown in
Second suffix length suffixLength#2 acquired by the second suffix length acquiring unit 207 is input to the second code length acquiring unit 211 and the second level decoding unit 212 and is used for the decoding of a subsequent variable-length code.
The second variable-length code shifter unit 208 supplies second variable-length code vlc#2 following first variable-length code vlc#1 from two consecutive variable-length codes vlc#1 and vlc#2 input from the delay unit 202 on the basis of first code length vlcLength#1 input from the first code length acquiring unit 205. If, for example, “0001000101 . . . ” is input from the delay unit 202 and first code length vlcLength#1 is 5, second variable-length code vlc#2 is “00101 . . . ”.
The second prefix decoding unit 209 obtains second prefix symbol level_prefix#2 and second prefix length prefixLength#2 from second variable-length code vlc#2 input from the second variable-length code shifter unit 208 on the basis of the code table shown in
The second code length acquiring unit 211 acquires code length vlcLength#2 (to be written as second code length vlcLength#2 hereinafter) of second variable-length code vlc#2 comprising second prefix level_prefix_code #2 and second suffix level_suffix_code#2 on the basis of second prefix length prefixLength#2 input from the second prefix decoding unit 209 and second suffix length suffixLength#2 output from the second suffix length acquiring unit 207 in accordance with the flowchart shown in
The second suffix shifter unit 210 supplies second suffix level_suffix_code#2 following second prefix level_prefix_code#2 from second variable-length code vlc#2 input from the second variable-length code shifter unit 208 on the basis of second prefix length prefixLength#2 input from the second prefix decoding unit 209. If, for example, second variable-length code vlc#2 is “00101 . . . ” and second prefix length prefixLength#2 is 3, second suffix level_suffix_code#2 is “01 . . . ”.
The second level decoding unit 212 decodes second level level#2 from second prefix symbol level_prefix#2 input from the second prefix decoding unit 209, second suffix level_suffix_code#2 supplied from the second suffix shifter unit 210, and second suffix length suffixLength#2 output from the second suffix length acquiring unit 207 on the basis of the code tables shown in
The second level decoding unit 212 includes the code tables shown in
The first suffix length acquiring unit 213 determines whether the absolute value of second level level#2 decoded by the second level decoding unit 212 exceeds a threshold corresponding to suffix length suffixLength written in the table shown in
First suffix length suffixLength#1 acquired by the first suffix length acquiring unit 213 is output to the delay unit 214, and is used for the decoding of the subsequent variable-length code to be decoded in the next cycle.
The total code length acquiring unit 215 adds two code lengths vlcLength#1 and vlcLength#2 acquired by the first code length acquiring unit 205 and the second code length acquiring unit 211, and outputs total code length vlcLengths of two consecutive decoded variable-length codes vlc#1 and vlc#2.
As described above, in the variable-length code decoding apparatus of the second embodiment, the first code length acquiring unit 205 acquires first code length vlcLength#1 which is necessary for the second variable-length code shifter unit 208 to supply second variable-length code vlc#2 on the basis of first prefix length prefixLength#1 output from the first prefix decoding unit 203 and first suffix length suffixLength#1 acquired by the first suffix length acquiring unit 213 before one cycle. That is, a code length necessary to supply second variable-length code vlc#2 is acquired before the completion of coding by the first level decoding unit 206.
In addition, the total code length acquiring unit 215 acquires total code length vlcLengths necessary to supply a variable-length code to be decoded in the next cycle on the basis of first code length vlcLength#1 acquired by the first code length acquiring unit 205 and second code length vlcLength#2 acquired by the second code length acquiring unit 211. That is, total code length vlcLengths is acquired before the completion of decoding by the second level decoding unit 212.
Therefore, the critical path of the circuit (the loop from the output of the delay unit 202 to the input of the delay unit 202) which decodes two variable-length codes in one cycle can be shortened, and the operating frequency can be increased. This makes it possible to increase the processing speed.
Note that the second embodiment has exemplified the decoding of two adjacent variable-length codes. However, according to the idea of the present invention, the number of adjacent codes is not limited to two, and the present invention can be applied to an arbitrary number (N) of codes as long as the processing power of the system permits.
As has been described above, in the variable-length code decoding apparatus of the present invention, since the length of a variable-length code used for supplying a variable-length code is acquired on the basis of the length of a prefix output from the prefix decoding unit and the length of a suffix acquired in advance, the next variable-length code can be supplied without using the decoding result obtained by the symbol decoding unit. Therefore, the critical path of the circuit decreases, and the operating frequency can be easily increased. This makes it possible to perform high-speed decoding processing. In addition, decoding a plurality of variable-length codes in one clock cycle makes it possible to perform faster decoding processing.
Note that the present invention can be applied to an apparatus comprising a single device or to system constituted by a plurality of devices.
Furthermore, the invention can be implemented by supplying a software program, which implements the functions of the foregoing embodiments, directly or indirectly to a system or apparatus, reading the supplied program code with a computer of the system or apparatus, and then executing the program code. In this case, so long as the system or apparatus has the functions of the program, the mode of implementation need not rely upon a program.
Accordingly, since the functions of the present invention are implemented by computer, the program code installed in the computer also implements the present invention. In other words, the claims of the present invention also cover a computer program for the purpose of implementing the functions of the present invention.
In this case, so long as the system or apparatus has the functions of the program, the program may be executed in any form, such as an object code, a program executed by an interpreter, or scrip data supplied to an operating system.
Example of storage media that can be used for supplying the program are a floppy disk, a hard disk, an optical disk, a magneto-optical disk, a CD-ROM, a CD-R, a CD-RW, a magnetic tape, a non-volatile type memory card, a ROM, and a DVD (a DVD-ROM, a DVD-R and a DVD-RW).
As for the method of supplying the program, a client computer can be connected to a website on the Internet using a browser of the client computer, and the computer program of the present invention or an automatically-installable compressed file of the program can be downloaded to a recording medium such as a hard disk. Further, the program of the present invention can be supplied by dividing the program code constituting the program into a plurality of files and downloading the files from different websites. In other words, a WWW (World Wide Web) server that downloads, to multiple users, the program files that implement the functions of the present invention by computer is also covered by the claims of the present invention.
It is also possible to encrypt and store the program of the present invention on a storage medium such as a CD-ROM, distribute the storage medium to users, allow users who meet certain requirements to download decryption key information from a website via the Internet, and allow these users to decrypt the encrypted program by using the key information, whereby the program is installed in the user computer.
Besides the cases where the aforementioned functions according to the embodiments are implemented by executing the read program by computer, an operating system or the like running on the computer may perform all or a part of the actual processing so that the functions of the foregoing embodiments can be implemented by this processing.
Furthermore, after the program read from the storage medium is written to a function expansion board inserted into the computer or to a memory provided in a function expansion unit connected to the computer, a CPU or the like mounted on the function expansion board or function expansion unit performs all or a part of the actual processing so that the functions of the foregoing embodiments can be implemented by this processing.
As many apparently widely different embodiments of the present invention can be made without departing from the spirit and scope thereof, it is to be understood that the invention is not limited to the specific embodiments thereof except as defined in the claims.
This application claims priority from Japanese Patent Application No. 2004-340806 filed on Nov. 25, 2004, which is hereby incorporated by reference herein.
Number | Date | Country | Kind |
---|---|---|---|
2004-340806 | Nov 2004 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
4647908 | Ross et al. | Mar 1987 | A |
5883589 | Takishima et al. | Mar 1999 | A |
7102550 | Watanabe et al. | Sep 2006 | B1 |
20050147172 | Winger et al. | Jul 2005 | A1 |
20050259742 | Hellman | Nov 2005 | A1 |
20060109150 | Naito | May 2006 | A1 |
20060119490 | Lim et al. | Jun 2006 | A1 |
Number | Date | Country |
---|---|---|
2004-134896 | Apr 2004 | JP |
Number | Date | Country | |
---|---|---|---|
20060109150 A1 | May 2006 | US |