US6937170B2 - Variable-length decoding apparatus and method, computer program, and computer-readable storage medium - Google Patents

Variable-length decoding apparatus and method, computer program, and computer-readable storage medium Download PDF

Info

Publication number
US6937170B2
US6937170B2 US10/814,510 US81451004A US6937170B2 US 6937170 B2 US6937170 B2 US 6937170B2 US 81451004 A US81451004 A US 81451004A US 6937170 B2 US6937170 B2 US 6937170B2
Authority
US
United States
Prior art keywords
code word
variable
symbol data
data
length code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
US10/814,510
Other versions
US20040196167A1 (en
Inventor
Katsumi Otsuka
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Publication of US20040196167A1 publication Critical patent/US20040196167A1/en
Assigned to CANON KABUSHIKI KAISHA reassignment CANON KABUSHIKI KAISHA ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: OTSUKA, KATSUMI
Application granted granted Critical
Publication of US6937170B2 publication Critical patent/US6937170B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
    • H03M7/42Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code using table look-up for the coding or decoding process, e.g. using read-only memory
    • H03M7/425Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code using table look-up for the coding or decoding process, e.g. using read-only memory for the decoding process only

Definitions

  • the present invention relates to a technique for decoding variable-length code words for still images or moving images.
  • a method which uses an entropy encoding technique by run length/category encoding and variable-length encoding as one of the compression encoding techniques for still images or moving images is conventionally known well. This technique is employed even in JPEG (Joint Photographic Experts Group) encoding and MPEG-1/-2 (Moving Picture Experts Group) encoding as international standards.
  • JPEG Joint Photographic Experts Group
  • MPEG-1/-2 Moving Picture Experts Group
  • an event for executing variable-length encoding is caused by implementing entropy encoding by assigning a Huffman code to a two-dimensional event called a run length and level (e.g., Japanese patent Laid-Open No. 2003-115767).
  • the two-dimensional event of run length and level will be referred to as a symbol.
  • a technique used for moving image compression encoding in recent years that has received a great deal of attention assigns a Huffman code to a three-dimensional event.
  • This technique has already been standardized by an encoding method called H.263 or MPEG-4.
  • a “last” significant coefficient in a DCT block called last is taken into consideration in addition to the run length and level used in two-dimensional encoding. For this reason, even when the values of the run length and level are the same, a Huffman code to be assigned changes depending on the last significant coefficient in the DCT block.
  • the three-dimensional event of run length, level, and last will also be referred to as a symbol.
  • MPEG-4 encoding when a symbol is not present in a predetermined Huffman code table, a fixed-length code called an escape is assigned. This also applies to MPEG-1/-2 encoding.
  • MPEG-4 encoding when a symbol is not present in a Huffman code table, first, a new symbol is defined by subtracting the value of the maximum level in the Huffman code table from the value of the level of the symbol, and the Huffman code table is searched for again. When it is determined as a result of the search that the symbol is present in the Huffman code table, a corresponding Huffman code is assigned.
  • a new symbol is defined by subtracting a value corresponding to (maximum run length in Huffman code table +1) from the value of the run length, and the Huffman code table is searched for again.
  • a corresponding Huffman code is assigned. If the symbol is not present, a fixed-length code is assigned.
  • FIG. 2 shows a variable-length decoding apparatus corresponding to MPEG-4 encoding, which is disclosed in Japanese Patent Laid-Open No. 2003-115767.
  • a portion corresponding to the block layer of a bitstream encoded by MPEG-4 encoding is input to a queuing means 201 .
  • the queuing means 201 includes a shifter circuit.
  • the queuing means 201 sequentially discards a bitstream in accordance with a shift amount requested by an operation control means 207 .
  • the start of the code word in a block layer is always queued.
  • the queuing means 201 executes the output operation in synchronism with a clock.
  • the queued code word is input parallel to five blocks, i.e., a DC decoder 202 , FLC decoder 203 , Huffman table 204 , Huffman table ESCR 205 , and Huffman table ESCL 206 .
  • the operation control means 207 asserts a DC data output signal to a functional block (not shown) on the output side to indicate that the result of decoding in the DC decoder 202 is effective by a code word when the value of the run length counted by a counter means (not shown) exceeds 64, and the last of symbol data output from a selection means 208 is “1” and indicates that it is the last significant coefficient.
  • the DC data output signal is negated to indicate that the output of the symbol data signal is effective.
  • Decoding processing of symbol data corresponding to the AC coefficient is done by the four blocks, i.e., the FLC decoder 203 , Huffman table 204 , Huffman table ESCR 205 , and Huffman table ESCL 206 .
  • All Huffman code words except escape code words of an intra-macro block table B.16 and inter-macro block table B.17, which are described in Annex.B of ISO/IEC14496-2, are registered in the Huffman table 204 .
  • For a bitstream input from the queuing means 201 it is determined whether the bitstream coincides with all Huffman code words. If the bitstream coincides with all Huffman code words, corresponding symbol data, Huffman code word length, and a hit signal representing coincidence are asserted.
  • the FLC decoder 203 decodes the symbol data when the input bitstream starts with escape code word +“11”.
  • a code word which starts with escape code word +“11” a run length, level, and event with a fixed length follow.
  • the data at a corresponding bit position is directly output as symbol data.
  • the selection means 208 selects and outputs symbol data and code word length, which are input from an asserted block, in the bit signals parallelly input from the four blocks, i.e., the FLC decoder 203 , Huffman table 204 , Huffman table ESCR 205 , and Huffman table ESCL 206 .
  • variable-length encoding apparatus When a variable-length encoding apparatus is constructed by hardware, all Huffman code words in the table B.16 and table B.17 are configured by a ROM or hardwired.
  • a Huffman table formed from a ROM or hardwired must be prepared in each of the three blocks, i.e., the Huffman table 204 , Huffman table ESCR 205 , and Huffman table ESCL 206 . Hence, the gate scale becomes large.
  • the present invention has been made in consideration of the above-described problems, and has as its object to provide a technique for decoding a variable-length code by using a small number of Huffman tables.
  • variable-length code decoding apparatus has, e.g., the following arrangement.
  • FIG. 1 is a block diagram of a variable-length decoding apparatus according to an embodiment
  • FIG. 2 is a block diagram of a variable-length decoding apparatus using a prior art
  • FIG. 3 is a block diagram showing the internal arrangement of a switch circuit shown in FIG. 1 ;
  • FIG. 4 is a block diagram showing the internal arrangement of an FLC decoder shown in FIG. 1 ;
  • FIG. 5 is a view showing a table representing values of LMAX used in the ESCL method
  • FIG. 6 is a view showing a table representing values of RMAX used in the ESCR method
  • FIG. 7 is a view showing a table representing the types of symbol data corresponding to the VLC, ESCL, and ESCR methods
  • FIG. 8 is a view showing a fixed-length code table of the FLC method.
  • FIG. 9 is a flow chart showing the sequence of processing according to the embodiment.
  • FIG. 1 is a block diagram of a variable-length decoding apparatus according to this embodiment.
  • This variable-length decoding apparatus decodes a bitstream which is encoded by MPEG-4 encoding.
  • decoding for an intra-macro block will specially be described for a descriptive convenience.
  • the present invention is not limited to this, as is apparent from the following description.
  • the bitstream of a block layer extracted from a bitstream analyzing unit is input to a queuing unit 101 .
  • the queuing unit 101 includes a shifter.
  • the queuing unit 101 shifts the received bitstream in accordance with a shift amount input from an operation control unit 105 and discards a previous code word in response to each clock.
  • the shift amount corresponds to a code word length.
  • FIG. 3 shows the arrangement of a switch circuit 102 .
  • comparators 301 and 302 determine whether 8-bit data “00000110” and “00000111” obtained by concatenating 7-bit data “0000011” corresponding to an escape code in MPEG-4 encoding and 1-bit data “0” or “1” coincide with SDATA[24:17] (eight bits from MSB).
  • the data “00000110” is used to detect a code word which is encoded by escape encoding called ESCL encoding.
  • the data “00000111” is used to detect a code word which is encoded by escape encoding called ESCR encoding.
  • Each of the comparators 301 and 302 is simply formed from an AND circuit.
  • Huffman encoding is executed for new symbol data obtained by subtracting a value LMAX shown in FIG. 5 from LEVEL of three-dimensional symbol data of RUN (run length), LEVEL (level), and LAST (last).
  • ESCR encoding Huffman encoding is executed for new symbol data obtained by subtracting a value RMAX shown in FIG. 6 from RUN of three-similar dimensional symbol data.
  • the output signals from the comparators 301 and 302 are input to ports C 0 and C 1 of a selector 303 . One of input ports A 0 to A 2 is selected and output in accordance with
  • a code word corresponding to A 0 is a code word obtained by executing corresponding Huffman encoding for three-dimensional data at the time of encoding without subtracting the LMAX or RMAX.
  • this method will be referred to as VLC encoding hereinafter.
  • all Huffman code words except escape codes of an intra-macro block table B.16 described in Annex.B of ISO/IEC14496-2, are stored in a Huffman table 104 by hardwired. It is determined whether the SWDATA[15:0] shown in FIG. 3 , which is input from the switch circuit 102 , coincides with all the stored Huffman code words. Symbol data corresponding to a Huffman code word that coincides with the input data and the code word length of the Huffman code word are output.
  • the symbol data to be output from the Huffman table 104 are calculated as three types of symbol data.
  • the three types of symbol data correspond to ESCL encoding, ESCR encoding, and VLC encoding, respectively.
  • a total of four types of data are input to a selection unit 106 , which include symbol data RUN+ and LEVEL+ output from the Huffman table 104 , data obtained by adding LMAX to LEVEL+, and data obtained by adding RMAX to RUN+.
  • the selection unit 106 selectively outputs two of the four types of data in accordance with the value of SDATA[24:17] as the output signal from the queuing unit 101 .
  • LMAX to be added to LEVEL+ is decided in accordance with the values of LAST and RUN+, as shown in FIG. 5 .
  • a selection unit 107 one of 11 values LMAX 0 to LMAX 11 shown in FIG. 5 , which are stored by hardwired in advance, is selected in accordance with the values of LAST and RUN+ and added to LEVEL+.
  • LEVEL+ is expressed by an absolute value.
  • a corresponding code is output from the Huffman table 104 as a symbol S.
  • the value of RMAX to be added to RUN+ is decided in accordance with the values of LAST and LEVEL+, as shown in FIG. 6 .
  • a selection unit 108 one of the values obtained by adding “+1” to 11 values RMAX 0 to RMAX 11 shown in FIG. 6 , which are stored by hardwired in advance, as in the selection unit 107 , is selected in accordance with the values of LAST and LEVEL+ and added to RUN+.
  • the selection unit 106 determines which of the three methods, i.e., VLC, ESCR, and ESCL, has been used to encode the code word currently queued by the queuing unit 101 and selects one of the three types of symbol data, as shown in FIG. 7 .
  • the output results from the comparators 301 and 302 used in the switch circuit 102 shown in FIG. 3 may be used for this determination.
  • An FLC decoder 110 decodes a fixed-length code.
  • the method using the fixed-length code is called an FLC method, which is executed when none of the VLC, ESCR, and ESCL methods are used for encoding.
  • symbol data is encoded by using a fixed-length code.
  • Bit lanes corresponding to the symbol data RUN, LEVEL, LAST, and S (sign bit) are selected from the queued code word output from the queuing unit 101 , and output.
  • the FLC decoder 110 can have an arrangement shown in FIG. 4 . To ensure the consistency to the formats of symbol data of the VLC, ESCR, and ESCL methods, for LEVEL, absolute value conversion is executed, and a code is output.
  • a selection unit 109 selects one of the two types of symbol data input from the selection unit 106 and FLC decoder 110 in accordance with the value of nine upper bits of the queued code word output from the queuing unit 101 .
  • the nine upper bits are “000001111”
  • the input from the FLC decoder 110 is selected. Otherwise, the input from the selection unit 106 is selected.
  • the operation control unit 105 first compares the effective bit length input from the queuing unit 101 with the code word length obtained by decoding. If the code word length is equal to or smaller than the effective bit length, it is determined that the decoding processing of the current clock cycle is effective. The effective data output signal is asserted to the block (not shown) on the output side. Pieces of information about the code word length are input from a DC decoder 103 and the Huffman table 104 . When the current clock cycle is a DC coefficient decoding cycle, a code word length input from the DC decoder 103 is output as a shift amount. In addition, the DC data output signal is asserted to the block (not shown) on the output side.
  • the selection unit 109 selects the output from the FLC decoder 110 , 30 bits are normally output as a shift amount. Otherwise, a code word length input from the Huffman table 104 is output as a shift amount.
  • the DC decoder 103 can be formed by using a conventionally known technique, and a description thereof will be omitted in this embodiment.
  • FIG. 9 is a flow chart showing the sequence of processing according to this embodiment, which particularly corresponds to decoding processing for an AC coefficient in a DCT block.
  • step S 901 a bitstream having a desired size is input to the queuing unit 101 .
  • This size corresponds to the memory size of the queuing unit and can be implemented by using a prior art, and a description thereof will be omitted.
  • step S 902 nine bits (nine upper bits) from the MSB of the SDATA[24:0] are compared with “000001111”. If they coincide, decoding is executed by the FLC decoder 110 . Decoding processing of one AC coefficient is thus ended.
  • steps S 903 to S 907 processing corresponding to the switch circuit 102 is executed. More specifically, in accordance with the value of eight bits from the MSB of the SDATA[24:0], the value of the 16 lower bits of SWADATA[15:0] is set by one of SDATA[24:9], SDATA[15:0], and SDATA[16:1] (steps S 905 to S 907 ).
  • comparison processing for the three tables i.e., the Huffman table 204 , Huffman table ESCR 205 , and Huffman table ESCL 206 , which is necessary in the processing of the prior art shown in FIG. 2 , can be implemented by only step S 909 , i.e., lookup table processing for the Huffman table 204 by using SWADATA[15:0].
  • steps S 910 to S 913 processing of the selection units 107 and 108 is implemented for RUN+ and LEVEL+ obtained in step S 909 in accordance with the value of eight bits from the MSB of the SDATA[24:0], thereby obtaining RUN and LEVEL as a final decoding result.
  • step S 914 when the output from the FLC decoder 110 is selected, 30 bits are normally output as a shift-out amount. Otherwise, a code word length input from the Huffman table 104 is output as a shift-out amount.
  • step S 915 The above processing is repeated until it is determined in step S 915 that the input of bitstream is ended.
  • the bitstream to be input to the Huffman table 104 is adaptively selected in accordance with the output data from the queuing unit 101 . Accordingly, the circuit scale of the Huffman table 104 can actually be reduced to 1 ⁇ 3 or less.
  • a computer program normally becomes executable when a computer-readable storage medium such as a CD-ROM is set in a computer, and the program is copied or installed in the system.
  • the present invention also incorporates such a computer-readable storage medium.
  • the scale of the Huffman table can be reduced.
  • decoding by software processing can be executed at a high speed.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

This invention reduces the scale of a Huffman table used for decoding. A queuing unit queues a variable-length code word from a received bitstream. A switch circuit discriminates the type of the code word in accordance with the pattern of a predetermined number of bits at the start of the queued variable-length code word, extracts data having a sufficient code word length from a predetermined bit position on the basis of the discrimination result, and outputs the result to a Huffman table. The Huffman table compares the data from the switch circuit with a variable-length code word stored in advance, and when the data and the variable-length code word coincide, outputs first symbol data. The Huffman table also generates a sum value for the first symbol data, and generates two second symbols from the sum result. A selection unit selects and outputs one of the first symbol and two second symbols in accordance with the type of the received code. A selection unit selects and outputs one of the symbol selected by the selection unit and a symbol from an FLC decoder on the basis of the data queued by the queuing unit.

Description

BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to a technique for decoding variable-length code words for still images or moving images.
2. Background of the Invention
A method which uses an entropy encoding technique by run length/category encoding and variable-length encoding as one of the compression encoding techniques for still images or moving images is conventionally known well. This technique is employed even in JPEG (Joint Photographic Experts Group) encoding and MPEG-1/-2 (Moving Picture Experts Group) encoding as international standards. In these encoding methods, an event for executing variable-length encoding is caused by implementing entropy encoding by assigning a Huffman code to a two-dimensional event called a run length and level (e.g., Japanese patent Laid-Open No. 2003-115767). The two-dimensional event of run length and level will be referred to as a symbol.
A technique used for moving image compression encoding in recent years that has received a great deal of attention assigns a Huffman code to a three-dimensional event. This technique has already been standardized by an encoding method called H.263 or MPEG-4. As for a three-dimensional event, a “last” significant coefficient in a DCT block called last is taken into consideration in addition to the run length and level used in two-dimensional encoding. For this reason, even when the values of the run length and level are the same, a Huffman code to be assigned changes depending on the last significant coefficient in the DCT block. The three-dimensional event of run length, level, and last will also be referred to as a symbol.
In MPEG-4 encoding, when a symbol is not present in a predetermined Huffman code table, a fixed-length code called an escape is assigned. This also applies to MPEG-1/-2 encoding. In MPEG-4 encoding, when a symbol is not present in a Huffman code table, first, a new symbol is defined by subtracting the value of the maximum level in the Huffman code table from the value of the level of the symbol, and the Huffman code table is searched for again. When it is determined as a result of the search that the symbol is present in the Huffman code table, a corresponding Huffman code is assigned. If the symbol is not present in the Huffman code table, a new symbol is defined by subtracting a value corresponding to (maximum run length in Huffman code table +1) from the value of the run length, and the Huffman code table is searched for again. When it is determined as a result of the search that the symbol is present in the Huffman code table, a corresponding Huffman code is assigned. If the symbol is not present, a fixed-length code is assigned.
FIG. 2 shows a variable-length decoding apparatus corresponding to MPEG-4 encoding, which is disclosed in Japanese Patent Laid-Open No. 2003-115767. A portion corresponding to the block layer of a bitstream encoded by MPEG-4 encoding is input to a queuing means 201. The queuing means 201 includes a shifter circuit. The queuing means 201 sequentially discards a bitstream in accordance with a shift amount requested by an operation control means 207. In the output from the queuing means 201, the start of the code word in a block layer is always queued. The queuing means 201 executes the output operation in synchronism with a clock. The queued code word is input parallel to five blocks, i.e., a DC decoder 202, FLC decoder 203, Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206.
The operation control means 207 asserts a DC data output signal to a functional block (not shown) on the output side to indicate that the result of decoding in the DC decoder 202 is effective by a code word when the value of the run length counted by a counter means (not shown) exceeds 64, and the last of symbol data output from a selection means 208 is “1” and indicates that it is the last significant coefficient. In other clock cycle, i.e., when symbol data corresponding to an AC coefficient is decoded, the DC data output signal is negated to indicate that the output of the symbol data signal is effective.
Decoding processing of symbol data corresponding to the AC coefficient is done by the four blocks, i.e., the FLC decoder 203, Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206. All Huffman code words, except escape code words of an intra-macro block table B.16 and inter-macro block table B.17, which are described in Annex.B of ISO/IEC14496-2, are registered in the Huffman table 204. For a bitstream input from the queuing means 201, it is determined whether the bitstream coincides with all Huffman code words. If the bitstream coincides with all Huffman code words, corresponding symbol data, Huffman code word length, and a hit signal representing coincidence are asserted.
Even in the Huffman table ESCR 205 and Huffman table ESCL 206, all Huffman code words, except escape code words of the table B.16 and the table B.17 are registered. However, in the Huffman table ESCR 205, an input bitstream is compared with a code word obtained by adding an escape code word +“0” before each Huffman code word, and in the Huffman table ESCL 206, an input bitstream is compared with a code word obtained by adding an escape code word +“10” before each Huffman code word, unlike the Huffman table 204.
The FLC decoder 203 decodes the symbol data when the input bitstream starts with escape code word +“11”. In a code word which starts with escape code word +“11”, a run length, level, and event with a fixed length follow. Hence, the data at a corresponding bit position is directly output as symbol data.
The selection means 208 selects and outputs symbol data and code word length, which are input from an asserted block, in the bit signals parallelly input from the four blocks, i.e., the FLC decoder 203, Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206.
When a variable-length encoding apparatus is constructed by hardware, all Huffman code words in the table B.16 and table B.17 are configured by a ROM or hardwired. When the variable-length decoding apparatus shown in FIG. 2 is implemented by hardware, a Huffman table formed from a ROM or hardwired must be prepared in each of the three blocks, i.e., the Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206. Hence, the gate scale becomes large.
In a playback apparatus which must execute real-time processing, high-speed decoding processing is required. In this case, a very large load acts on the logic of the output stage from the queuing means 201, and it is therefore difficult to increase the operating frequency. When decoding processing is implemented by software by using a prior art, for a bitstream encoded using the Huffman table ESCR 205, the input code word is compared with all the Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206. Since enormous comparison calculation is necessary, real-time decoding can hardly be implemented.
SUMMARY OF THE INVENTION
The present invention has been made in consideration of the above-described problems, and has as its object to provide a technique for decoding a variable-length code by using a small number of Huffman tables.
In order to solve the above problems, a variable-length code decoding apparatus according to the present invention has, e.g., the following arrangement.
A variable-length code decoding apparatus which receives a bitstream of variable-length-encoded image data and outputs symbol data comprises:
    • queuing means for queuing a variable-length code word from the received bitstream;
    • discrimination means for discriminating a type of a code word in accordance with a pattern of a predetermined number of bits at a start of the variable-length code word queued by the queuing means;
    • extraction means for extracting data having a sufficient code word length from a predetermined bit position on the basis of a discrimination result from the discrimination means;
    • a Huffman table which compares the extracted data with a variable-length code word stored in advance, and when the data and the variable-length code word coincide, outputs first symbol data;
    • addition arithmetic means for generating, for the first symbol data output from the Huffman table, a sum value corresponding to the first symbol data and adding the generated sum value to the first symbol to output a plurality of types of second symbol data;
    • decoding means for selecting a predetermined bit lane from the variable-length code word queued by the queuing means and outputting the bit lane as third symbol data; and
    • selection means for selecting and outputting one of the first symbol data output from the Huffman table, the second symbol data generated by the addition arithmetic means, and the third symbol data generated by the decoding means, in accordance with a value of the variable-length code word queued by the queuing means.
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.
BRIEF DESCRIPTION OF THE DRAWINGS
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.
FIG. 1 is a block diagram of a variable-length decoding apparatus according to an embodiment;
FIG. 2 is a block diagram of a variable-length decoding apparatus using a prior art;
FIG. 3 is a block diagram showing the internal arrangement of a switch circuit shown in FIG. 1;
FIG. 4 is a block diagram showing the internal arrangement of an FLC decoder shown in FIG. 1;
FIG. 5 is a view showing a table representing values of LMAX used in the ESCL method;
FIG. 6 is a view showing a table representing values of RMAX used in the ESCR method;
FIG. 7 is a view showing a table representing the types of symbol data corresponding to the VLC, ESCL, and ESCR methods;
FIG. 8 is a view showing a fixed-length code table of the FLC method; and
FIG. 9 is a flow chart showing the sequence of processing according to the embodiment.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
An embodiment according to the present invention will be described below in detail with reference to the accompanying drawings.
FIG. 1 is a block diagram of a variable-length decoding apparatus according to this embodiment.
This variable-length decoding apparatus decodes a bitstream which is encoded by MPEG-4 encoding. In this embodiment, decoding for an intra-macro block will specially be described for a descriptive convenience. However, the present invention is not limited to this, as is apparent from the following description.
The bitstream of a block layer extracted from a bitstream analyzing unit (not shown) is input to a queuing unit 101. The queuing unit 101 includes a shifter. The queuing unit 101 shifts the received bitstream in accordance with a shift amount input from an operation control unit 105 and discards a previous code word in response to each clock. The shift amount corresponds to a code word length. Hence, in the bitstream output from the queuing unit 101, the code word is always queued.
FIG. 3 shows the arrangement of a switch circuit 102. When 25-bit data is input from the MSB side of the output of the queuing unit, which corresponds to SDATA[24:0] in FIG. 3, comparators 301 and 302 determine whether 8-bit data “00000110” and “00000111” obtained by concatenating 7-bit data “0000011” corresponding to an escape code in MPEG-4 encoding and 1-bit data “0” or “1” coincide with SDATA[24:17] (eight bits from MSB). The data “00000110” is used to detect a code word which is encoded by escape encoding called ESCL encoding. The data “00000111” is used to detect a code word which is encoded by escape encoding called ESCR encoding. Each of the comparators 301 and 302 is simply formed from an AND circuit.
In ESCL encoding, Huffman encoding is executed for new symbol data obtained by subtracting a value LMAX shown in FIG. 5 from LEVEL of three-dimensional symbol data of RUN (run length), LEVEL (level), and LAST (last). In ESCR encoding, Huffman encoding is executed for new symbol data obtained by subtracting a value RMAX shown in FIG. 6 from RUN of three-similar dimensional symbol data. The output signals from the comparators 301 and 302 are input to ports C0 and C1 of a selector 303. One of input ports A0 to A2 is selected and output in accordance with
    • IF(C0=‘1’ AND C1=‘0’)//ESCL
      • B=A1
    • ELSE IF(C0=‘0’ AND C1=‘1’)//ESCR
      • B=A2
    • ELSE//VLC
      • B=A0
This will briefly be described next.
When eight bits from the start of the 25-bit data coincide with an ESCL code “00000110”, 16 bits from bit 16 to bit 1 supplied to the input port A1 are output as SWDATA[15:0]. When the eight bits coincide with an ESCR code “00000111”, 16 bits from bit 15 to bit 0 supplied to the input port A2 are output as SWDATA[15:0]. Otherwise (when C0=C1=0), 16 bits from bit 24 to bit 9 supplied to the input port A0 are output as SWDATA[15:0]. That is, the comparators 301 and 302 discriminate the type of the code word in accordance with the pattern of a predetermined number of bits at the start of the variable-length code word.
A code word corresponding to A0 is a code word obtained by executing corresponding Huffman encoding for three-dimensional data at the time of encoding without subtracting the LMAX or RMAX. In this embodiment, this method will be referred to as VLC encoding hereinafter.
Referring back to FIG. 1, all Huffman code words, except escape codes of an intra-macro block table B.16 described in Annex.B of ISO/IEC14496-2, are stored in a Huffman table 104 by hardwired. It is determined whether the SWDATA[15:0] shown in FIG. 3, which is input from the switch circuit 102, coincides with all the stored Huffman code words. Symbol data corresponding to a Huffman code word that coincides with the input data and the code word length of the Huffman code word are output.
The symbol data to be output from the Huffman table 104 are calculated as three types of symbol data. The three types of symbol data correspond to ESCL encoding, ESCR encoding, and VLC encoding, respectively. A total of four types of data are input to a selection unit 106, which include symbol data RUN+ and LEVEL+ output from the Huffman table 104, data obtained by adding LMAX to LEVEL+, and data obtained by adding RMAX to RUN+. The selection unit 106 selectively outputs two of the four types of data in accordance with the value of SDATA[24:17] as the output signal from the queuing unit 101. The value of LMAX to be added to LEVEL+ is decided in accordance with the values of LAST and RUN+, as shown in FIG. 5. In a selection unit 107, one of 11 values LMAX0 to LMAX11 shown in FIG. 5, which are stored by hardwired in advance, is selected in accordance with the values of LAST and RUN+ and added to LEVEL+. LEVEL+ is expressed by an absolute value. A corresponding code is output from the Huffman table 104 as a symbol S. The value of RMAX to be added to RUN+ is decided in accordance with the values of LAST and LEVEL+, as shown in FIG. 6. In a selection unit 108, one of the values obtained by adding “+1” to 11 values RMAX0 to RMAX11 shown in FIG. 6, which are stored by hardwired in advance, as in the selection unit 107, is selected in accordance with the values of LAST and LEVEL+ and added to RUN+.
On the other hand, the selection unit 106 determines which of the three methods, i.e., VLC, ESCR, and ESCL, has been used to encode the code word currently queued by the queuing unit 101 and selects one of the three types of symbol data, as shown in FIG. 7. The output results from the comparators 301 and 302 used in the switch circuit 102 shown in FIG. 3 may be used for this determination.
An FLC decoder 110 decodes a fixed-length code. In this embodiment, the method using the fixed-length code is called an FLC method, which is executed when none of the VLC, ESCR, and ESCL methods are used for encoding. In the FLC method, symbol data is encoded by using a fixed-length code. Bit lanes corresponding to the symbol data RUN, LEVEL, LAST, and S (sign bit) are selected from the queued code word output from the queuing unit 101, and output. The FLC decoder 110 can have an arrangement shown in FIG. 4. To ensure the consistency to the formats of symbol data of the VLC, ESCR, and ESCL methods, for LEVEL, absolute value conversion is executed, and a code is output.
A selection unit 109 selects one of the two types of symbol data input from the selection unit 106 and FLC decoder 110 in accordance with the value of nine upper bits of the queued code word output from the queuing unit 101. When the nine upper bits are “000001111”, the input from the FLC decoder 110 is selected. Otherwise, the input from the selection unit 106 is selected.
The operation control unit 105 first compares the effective bit length input from the queuing unit 101 with the code word length obtained by decoding. If the code word length is equal to or smaller than the effective bit length, it is determined that the decoding processing of the current clock cycle is effective. The effective data output signal is asserted to the block (not shown) on the output side. Pieces of information about the code word length are input from a DC decoder 103 and the Huffman table 104. When the current clock cycle is a DC coefficient decoding cycle, a code word length input from the DC decoder 103 is output as a shift amount. In addition, the DC data output signal is asserted to the block (not shown) on the output side.
When the current clock cycle is an AC coefficient decoding cycle, and the selection unit 109 selects the output from the FLC decoder 110, 30 bits are normally output as a shift amount. Otherwise, a code word length input from the Huffman table 104 is output as a shift amount.
The DC decoder 103 can be formed by using a conventionally known technique, and a description thereof will be omitted in this embodiment.
A processing flow when the constituent elements shown in FIG. 1 are implemented by software modules will be described next. FIG. 9 is a flow chart showing the sequence of processing according to this embodiment, which particularly corresponds to decoding processing for an AC coefficient in a DCT block.
First, in step S901, a bitstream having a desired size is input to the queuing unit 101. This size corresponds to the memory size of the queuing unit and can be implemented by using a prior art, and a description thereof will be omitted.
In step S902, nine bits (nine upper bits) from the MSB of the SDATA[24:0] are compared with “000001111”. If they coincide, decoding is executed by the FLC decoder 110. Decoding processing of one AC coefficient is thus ended.
In steps S903 to S907, processing corresponding to the switch circuit 102 is executed. More specifically, in accordance with the value of eight bits from the MSB of the SDATA[24:0], the value of the 16 lower bits of SWADATA[15:0] is set by one of SDATA[24:9], SDATA[15:0], and SDATA[16:1] (steps S905 to S907). By this processing in steps S903 to S907, comparison processing for the three tables, i.e., the Huffman table 204, Huffman table ESCR 205, and Huffman table ESCL 206, which is necessary in the processing of the prior art shown in FIG. 2, can be implemented by only step S909, i.e., lookup table processing for the Huffman table 204 by using SWADATA[15:0].
In steps S910 to S913, processing of the selection units 107 and 108 is implemented for RUN+ and LEVEL+ obtained in step S909 in accordance with the value of eight bits from the MSB of the SDATA[24:0], thereby obtaining RUN and LEVEL as a final decoding result.
In step S914, when the output from the FLC decoder 110 is selected, 30 bits are normally output as a shift-out amount. Otherwise, a code word length input from the Huffman table 104 is output as a shift-out amount.
The above processing is repeated until it is determined in step S915 that the input of bitstream is ended.
As described above, according to this embodiment, the bitstream to be input to the Huffman table 104 is adaptively selected in accordance with the output data from the queuing unit 101. Accordingly, the circuit scale of the Huffman table 104 can actually be reduced to ⅓ or less.
When the constituent elements shown in FIG. 1 are implemented by software modules, the number of processing steps can actually be decreased to ⅓ or less of the prior art.
A computer program normally becomes executable when a computer-readable storage medium such as a CD-ROM is set in a computer, and the program is copied or installed in the system. The present invention also incorporates such a computer-readable storage medium.
As described above, according to the embodiment, the scale of the Huffman table can be reduced. In addition, decoding by software processing can be executed at a high speed.
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 appended claims.

Claims (7)

1. A variable-length code decoding apparatus which receives a bitstream of variable-length-encoded image data and outputs symbol data, comprising:
queuing means for queuing a variable-length code word from the received bitstream;
discrimination means for discriminating a type of a code word in accordance with a pattern of a predetermined number of bits at a start of the variable-length code word queued by said queuing means;
extraction means for extracting data having a sufficient code word length from a predetermined bit position on the basis of a discrimination result from said discrimination means;
a Huffman table which compares the extracted data with a variable-length code word stored in advance, and when the data and the variable-length code word coincide, outputs first symbol data;
computing means for modifying, for the first symbol data output from said Huffman table, the first symbol data and generating a plurality of types of second symbol data in accordance with the modified first symbol;
decoding means for selecting a predetermined bit lane from the variable-length code word queued by said queuing means and outputting the bit lane as third symbol data; and
selection means for selecting and outputting one of the first symbol data output from said Huffman table, the second symbol data generated by said computing means, and the third symbol data generated by said decoding means, in accordance with a value of the variable-length code word queued by said queuing means.
2. The apparatus according to claim 1, wherein the symbol data calculated by said computing means are RUN and LEVEL.
3. The apparatus according to claim 1, wherein said discrimination means discriminates whether the code word is an escape code.
4. The apparatus according to claim 1, wherein the received bitstream is image data encoded by MPEG-4 encoding.
5. A variable-length code decoding method which receives a bitstream of variable-length-encoded image data and decodes the bitstream to at least symbol data, comprising:
a queuing step, of queuing a variable-length code word from the received bitstream;
a discrimination step, of discriminating a type of a code word in accordance with a pattern of a predetermined number of bits at a start of the variable-length code word queued in said queuing step;
an extraction step, of extracting data having a sufficient code word length from a predetermined bit position on the basis of a discrimination result obtained in said discrimination step;
a Huffman decoding step, of comparing the extracted data with a variable-length code word stored in advance as a Huffman table, and when the data and the variable-length code word coincide, outputting first symbol data;
a computing step, of modifying, for the first symbol data output in said Huffman decoding step, the first symbol data and generating a plurality of types of second symbol data in accordance with the modified first symbol;
a decoding step, of selecting a predetermined bit lane from the variable-length code word queued in said queuing step and outputting the bit lane as third symbol data; and
a selection step, of selecting and outputting one of the first symbol data output from the Huffman table, the second symbol data generated in said computing step, and the third symbol data generated in said decoding step, in accordance with a value of the variable-length code word queued in said queuing step.
6. A computer program which functions as a variable-length code decoding apparatus which receives a bitstream of variable-length encoded image data and outputs symbol data, characterized by functioning as:
queuing means for queuing a variable-length code word from the received bitstream;
discrimination means for discriminating a type of a code word in accordance with a pattern of a predetermined number of bits at a start of the variable-length code word cued by said queuing means;
extraction means for extracting data having a sufficient code word length from a predetermined bit position on the basis of a discrimination result from said discrimination means;
a Huffman table which compares the extracted data with a variable-length code word stored in advance, and when the data and the variable-length code word coincide, outputs first symbol data;
computing means for modifying, for the first symbol data output from said Huffman table, the first symbol data and generating a plurality of types of second symbol data in accordance with the modified first symbol;
decoding means for selecting a predetermined bit lane from the variable-length code word queued by said queuing means and outputting the bit lane as third symbol data;
selection means for selecting and outputting one of the first symbol data output from said Huffman table, the second symbol data generated by said computing means, and the third symbol data generated by said decoding means, in accordance with a value of the variable-length code word queued by said queuing means.
7. A computer-readable storage medium which stores a computer program of claim 6.
US10/814,510 2003-04-01 2004-04-01 Variable-length decoding apparatus and method, computer program, and computer-readable storage medium Expired - Fee Related US6937170B2 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP2003-098040 2003-04-01
JP2003098040 2003-04-01
JP2004-038815 2004-02-16
JP2004038815A JP4537089B2 (en) 2003-04-01 2004-02-16 Variable length decoding apparatus and method, computer program, and computer readable storage medium

Publications (2)

Publication Number Publication Date
US20040196167A1 US20040196167A1 (en) 2004-10-07
US6937170B2 true US6937170B2 (en) 2005-08-30

Family

ID=33100408

Family Applications (1)

Application Number Title Priority Date Filing Date
US10/814,510 Expired - Fee Related US6937170B2 (en) 2003-04-01 2004-04-01 Variable-length decoding apparatus and method, computer program, and computer-readable storage medium

Country Status (2)

Country Link
US (1) US6937170B2 (en)
JP (1) JP4537089B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040202375A1 (en) * 2003-01-13 2004-10-14 Nokia Corporation Processing of images using a limited number of bits
US20100195739A1 (en) * 2009-02-04 2010-08-05 Novatek Microelectronics Corp. Adaptive canonical huffman decoder and method thereof and video decoder
US20100259427A1 (en) * 2006-10-31 2010-10-14 Canon Kabushiki Kaisha Entropy coding apparatus
US20130229292A1 (en) * 2012-03-05 2013-09-05 Samsung Electronics Co., Ltd. Apparatus and method for decoding

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7573406B2 (en) * 2004-05-21 2009-08-11 Broadcom Corporation System and method for decoding context adaptive variable length coding

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6125229A (en) * 1997-06-02 2000-09-26 Philips Electronics North America Corporation Visual indexing system
US6137544A (en) * 1997-06-02 2000-10-24 Philips Electronics North America Corporation Significant scene detection and frame filtering for a visual indexing system
US20020090142A1 (en) 2000-12-19 2002-07-11 Susumu Igarashi Image processing method, apparatus, and storage medium
US20020122599A1 (en) 2001-02-13 2002-09-05 Canon Kabushiki Kaisha Image coder/decoder, image coding/decoding method, and storage medium
US20020164080A1 (en) 2001-02-28 2002-11-07 Canon Kabushi Kaisha Decoding apparatus, decoding method, storage medium and program software
US20030058143A1 (en) 2001-09-27 2003-03-27 Yukio Chiba Image coding apparatus, variable-length coding apparatus, control apparatus and method thereof
JP2003115767A (en) 2001-10-05 2003-04-18 Canon Inc Decoding device and method therefor
US6603413B2 (en) 2001-02-07 2003-08-05 Canon Kabushiki Kaisha Variable-length decoding apparatus and method
US20030219164A1 (en) 2002-04-09 2003-11-27 Cannon Kabushiki Kaisha Entropy coding apparatus
US20040017855A1 (en) 2002-05-29 2004-01-29 Canon Kabushiki Kaisha Variable-length encoding apparatus and method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04119013A (en) * 1990-09-07 1992-04-20 Hitachi Ltd Variable length coder, variable length decoder, picture coder and picture decoder
JP2638424B2 (en) * 1993-05-28 1997-08-06 日本電気株式会社 Variable length decoding device
JP2000023195A (en) * 1998-06-26 2000-01-21 Sony Corp Image encoding device and method, image decoding device and method and encoded data providing medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6125229A (en) * 1997-06-02 2000-09-26 Philips Electronics North America Corporation Visual indexing system
US6137544A (en) * 1997-06-02 2000-10-24 Philips Electronics North America Corporation Significant scene detection and frame filtering for a visual indexing system
US20020090142A1 (en) 2000-12-19 2002-07-11 Susumu Igarashi Image processing method, apparatus, and storage medium
US6603413B2 (en) 2001-02-07 2003-08-05 Canon Kabushiki Kaisha Variable-length decoding apparatus and method
US20020122599A1 (en) 2001-02-13 2002-09-05 Canon Kabushiki Kaisha Image coder/decoder, image coding/decoding method, and storage medium
US20020164080A1 (en) 2001-02-28 2002-11-07 Canon Kabushi Kaisha Decoding apparatus, decoding method, storage medium and program software
US20030058143A1 (en) 2001-09-27 2003-03-27 Yukio Chiba Image coding apparatus, variable-length coding apparatus, control apparatus and method thereof
JP2003115767A (en) 2001-10-05 2003-04-18 Canon Inc Decoding device and method therefor
US20030219164A1 (en) 2002-04-09 2003-11-27 Cannon Kabushiki Kaisha Entropy coding apparatus
US20040017855A1 (en) 2002-05-29 2004-01-29 Canon Kabushiki Kaisha Variable-length encoding apparatus and method

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040202375A1 (en) * 2003-01-13 2004-10-14 Nokia Corporation Processing of images using a limited number of bits
US7715638B2 (en) * 2003-01-13 2010-05-11 Nokia Corporation Processing of images using a limited number of bits
USRE43256E1 (en) * 2003-01-13 2012-03-20 Nokia Corporation Processing of images using a limited number of bits
US20100259427A1 (en) * 2006-10-31 2010-10-14 Canon Kabushiki Kaisha Entropy coding apparatus
US7898445B2 (en) 2006-10-31 2011-03-01 Canon Kabushiki Kaisha Entropy coding apparatus
US20100195739A1 (en) * 2009-02-04 2010-08-05 Novatek Microelectronics Corp. Adaptive canonical huffman decoder and method thereof and video decoder
US8306108B2 (en) * 2009-02-04 2012-11-06 Novatek Microelectronics Corp. Adaptive canonical Huffman decoder and method thereof and video decoder
US20130229292A1 (en) * 2012-03-05 2013-09-05 Samsung Electronics Co., Ltd. Apparatus and method for decoding
US8674857B2 (en) * 2012-03-05 2014-03-18 Samsung Electronics Co., Ltd. Apparatus and method for decoding

Also Published As

Publication number Publication date
US20040196167A1 (en) 2004-10-07
JP2004320724A (en) 2004-11-11
JP4537089B2 (en) 2010-09-01

Similar Documents

Publication Publication Date Title
US7079057B2 (en) Context-based adaptive binary arithmetic coding method and apparatus
JP3332619B2 (en) Decoding device and method thereof
US6603413B2 (en) Variable-length decoding apparatus and method
US7496143B2 (en) Method and arrangement for coding transform coefficients in picture and/or video coders and decoders and a corresponding computer program and a corresponding computer-readable storage medium
US6215424B1 (en) System for variable length codeword processing suitable for video and other applications
US5841381A (en) Huffman coding/decoding using an intermediate code number
EP1237123A2 (en) Decoding apparatus and method
US20060209965A1 (en) Method and system for fast run-level encoding
US5841380A (en) Variable length decoder and method for decoding two codes per clock cycle
US7522076B1 (en) Parallel context adaptive binary arithmetic coding
US6408102B1 (en) Encoding/decoding device
US6937170B2 (en) Variable-length decoding apparatus and method, computer program, and computer-readable storage medium
Min et al. A memory-efficient VLC decoder architecture for MPEG-2 application
KR100466455B1 (en) Code converter, variable length code decoder and method of decoding variable length code
US20060109148A1 (en) Binary image-processing device and method using symbol dictionary rearrangement
US5321397A (en) Data encoder for producing and storing info runlength value, bit length values and encoded words from input data values
CN112449201B (en) Decoding method, encoding method, corresponding devices, electronic equipment and storage medium
CN112449186B (en) Encoding method, decoding method, corresponding devices, electronic equipment and storage medium
JPH11103257A (en) Arithmetic encoding/decoding device
JPH02272970A (en) Data processing circuit
JP2003174365A (en) Decoding device and its method
US5619200A (en) Code table reduction apparatus for variable length decoder
JP3021329B2 (en) Variable length decoding method and apparatus
JP2002091407A (en) Picture display device
JP2842045B2 (en) Data compression device

Legal Events

Date Code Title Description
AS Assignment

Owner name: CANON KABUSHIKI KAISHA, JAPAN

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:OTSUKA, KATSUMI;REEL/FRAME:016569/0561

Effective date: 20040520

CC Certificate of correction
FPAY Fee payment

Year of fee payment: 4

FPAY Fee payment

Year of fee payment: 8

REMI Maintenance fee reminder mailed
LAPS Lapse for failure to pay maintenance fees

Free format text: PATENT EXPIRED FOR FAILURE TO PAY MAINTENANCE FEES (ORIGINAL EVENT CODE: EXP.)

STCH Information on status: patent discontinuation

Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362

FP Lapsed due to failure to pay maintenance fee

Effective date: 20170830