Decoding apparatus

Abstract: A decoding circuit in which the data error does not propagate to the next DCT block is provided. In response to a reset signal a down-counter (13) reads a process number set from a process number setting unit (12), and counts down the process number according to the entered clock pulses. A comparator (14) compares the count of the down-counter (13) and the non-zero/zero-run mixed data from a lookup table (2), and releases an A < B flag in case the latter is larger. This flag is supplied to an OR gate (15) and a NAND gate (16) and, if it is H-level, forcedly shifts the non-zero/ zero-run flag to the H-level. The outputs of the NAND gate (16) and of the OR gate (15) are logically multiplied and sent to an AND gate group (5), which replaces the zero-run data with non-zero data "0".

Description: The present invention relates to a decoding apparatus, and more particularly a decoding apparatus for decoding, for example, a variable-length encoded image. Among various methods proposed for high efficiency encoding, the so-called hybrid DCT method according to the CMTT/2 Recommendation 723 is known as the representative high efficiency encoding method in the field of images. Also B2 code is proposed as the variable-length codes for these encoding methods. These encoding methods and the B2 code are detailedly described by Y. Ohtsuka, "Encoding technologies for current television and HDTV", J. of Television Association, Vol. 45, No. 7, pp.800 - 802(1991). In said hybrid DCT method, for the non-zero coefficients and the zero-run value, the B2 code transmits expansion codes and information codes alternately, taking two bits as a pair, with an expansion code "0" as a partition (stop code). However the stop code is not transmitted only in case of the maximum code length. Also shorter codes are assigned to the non-zero coefficients and the zero-run value, in the descending order of the frequency of appearance thereof. The B2 code has a feature that the expansion code and the information code have clear positions. If the expansion code is erroneous, there may result a phenomenon that a code appears as two codes or two codes appear as a code, but the error does not propagate to the next DCT block, as long as an EOB code, indicating that all the subsequent coefficients are zero to the end of the DCT block, is properly detected. Fig. 5 shows an example of the B2 code, and Fig. 3 shows a conventional variable-length decoding circuit for decoding the codes which are variable-length encoded by the B2 code system. Referring to Fig. 3, a data input terminal 121 receives data, in the form of a word of a predetermined bit width, including codes from two bits at minimum to the maximum code bit length, encoded in the B2 code system. A terminal 122 receives the clock signal, and a data output terminal 123 releases the variable-length decoded data. The B2 code data, entered from the data input terminal 121, are supplied to a shifter circuit 101, and are released therefrom with a shift to the leading bit of the B2 code. The shifter circuit 101 is provided with an input terminal S for the shift amount. The output of the shifter circuit 101 is supplied to a terminal a of a look-up table (LUT) 102, of which a terminal b releases the B2 code length, while a terminal c releases non-zero (meaning quantized coefficient (including "0"))/zero-run mixed data, and a terminal d releases a non-zero/zero-run flag. The B2 code length released from the LUT 102 and the cumulative bit number of the B2 code lengths, until the immediately preceding clock signal, stored in a register 104 are added in a adder 103, and the cumulative sum released therefrom is supplied to the terminal S of the shifter circuit 101. When the non-zero/zero-run flag from the LUT 102 is at the H-level, the non-zero/zero-run mixed data from the LUT 102 are transmitted through an AND gate group 105 and released from the data output terminal 123. When the non-zero/zero-run flag from the LUT 102 is at the L-level, the outputs from the data output terminal 123 are made all zero by the ABD gate group 105. In this case, the non-zero/zero-run mixed data indicate the zero-run value, which are subjected to bit inversion in an inverter 106 and an addition of "1" in an adder 107, and are supplied to a terminal D of a counter 108. In case the non-zero/zero-run flag, supplied to a terminal E thereof, is at the L-level, the counter 108 effects counting operation in response to the clock signal supplied to a terminal C. The output of the counter 108 is supplied to an end detector 109. The output (zero period end flag) of the end detection circuit 109, the result of detection of the zero-run value "1" released from a "1" detector 110, and the non-zero/zero-run flag are subjected to logic summation in an OR gate 111, of which output is supplied to a terminal E of a register 104. When said terminal E of the register 104 is at the H-level, the register selects a terminal A for input, and renews the cumulative bit number. When said terminal E is at the L-level, a terminal B is selected and the cumulative bit number is retained. Figs. 4A to 4G are timing charts showing the functions of the conventional variable-length decoding circuit. Input data shown in Fig. 4B are encoded by the combination of non-zero/zero-run mixed data and non-zero/zero-run flag shown in Fig. 5, and encoded data shown in Fig. 6 can be decoded, by the variable-length decoding circuit shown in Fig. 3, with timings shown in Figs. 4A to 4G. However, the conventional configuration explained above has been associated with the following drawback. In case the zero-run data vary to a value larger than the number of clock signals for processing the remaining DCT block, or the non-zero data vary to zero-run data, due to an error on the transmission channel prior to the detection of the EOB code, the error propagates to the next DCT block, in case of the conventional variable-length decoding circuit as shown in Fig. 3, whereby the decoded image is aberrated, for example in the position on the image frame. In consideration of the foregoing, an aim of the present invention is to provide a decoding circuit in which an error in the data does not propagate to a succeeding image. According to the present invention thre is provided decoding apparatus comprising: receiving means for receiving a variable-length code which corresponds to run-length data or non-run-length data defining pixels of an image; decoding means for decoding the variable-length code in synchronization with a predetermined timing signal, to generate run-length data or non-run-length data accordingly; counting means for counting the timing signal to determine the number (A) of pixels remaining to be decoded; comparing means for comparing said number remaining (A) with a run length (B) defined in said run-length data; and output means for replacing the run-length data with non-run length data when said run length (B) exceeds the number (A) of pixels remaining to be decoded. The disclosed embodiments provide a decoding method as defined in claim 5 suitable for block encoding, without propagation of errors between succeeding blocks. Embodiments of the present invention further provide a decoding apparatus suitable for high-speed processing. These features of the present invention, and the advantages thereof, will become fully apparent from the following description, to be taken in conjunction with the attached drawings, and from the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of a variable-length decoding circuit embodying the present invention; Figs. 2A to 2G are timing charts showing an example of the function of said embodiment; Fig. 3 is a block diagram of a conventional variable-length decoding circuit; Figs. 4A to 4G are timing charts showing the function of the conventional variable-length decoding circuit. Fig. 5 is a view showing an example of B2 code; and Fig. 6 is a view showing the correspondence between the non-zero/zero-run flags and the encoded data. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Now the present invention will be clarified in detail by an embodiment thereof shown in the attached drawings. Fig. 1 is a block diagram showing the configuration of a variable-length decoding circuit embodying the present invention. Referring to Fig. 1, a data input terminal 21 receives data, in the form of a word of a predetermined bit width, including codes from two bits at minimum to the maximum code bit length, encoded in the B2 code system. An input terminal 22 receives the clock signal, and a data output terminal 23 releases the variable-length decoded data. The B2 code data, entered from the data input terminal 21, are supplied to a shifter circuit 1, and are released therefrom with a shift to the leading bit of the B2 code. The shifter circuit 1 is provided with an input terminal S for entering the shift amount. The output of the shifter circuit 1 is supplied to a terminal a of a look-up table (LUT) 2, of which a terminal b releases the B2 code length, while a terminal c releases non-zero/zero-run mixed data, and a terminal d releases a non-zero/zero-run flag. Said LUT 2 is composed of a ROM, a RAM or a logic circuit. There are also provided an adder 3 and a register 4. The B2 code length released from the LUT 2 and the cumulatively consumed bit number of the B2 code lengths, until the immediately preceding clock signal, stored in said register 4, are supplied to and added in the adder 3. The cumulative sum released from the adder 3 is supplied to the terminal S of the shifter circuit 1. An AND gate group 5 transmits the non-zero/zero-run mixed data, released from the LUT 2, for releasing from the data output terminal 23, in case the non-zero/zero-run flag from the LUT 2 is at the H-level. In case the non-zero/zero-run flag is at the L-level, the data from the output terminal 23 are made all zero by the AND gate group 5. In this state the non-zero/zero-run mixed data indicate the zero-run value, which is subjected to bit inversion by an inverter 6, then addition of "1" by an adder 7, and supplied to a terminal D of an up-counter 8. The up-counter 8 effects an up-counting operation by the clock signal supplied to a terminal C, in case the non-zero/zero-run flag supplied to the terminal E is at the L-level. The output of said up-counter 8 is supplied to an end detector 9. The output (zero period end flag) of the end detection circuit 9, the result of detection for the zero-run value "1" from a "1" detector 10, and the non-zero/zero-run flag are subjected to logic summation in an OR gate 11, of which output is supplied to a terminal E of the register 4. In case the terminal E is at the H-level, the register 4 selects a terminal A for input, and renews the cumulatively consumed bit number, but, in case said terminal E is at the L-level, a terminal B is selected and the cumulative bit number is retained. A reset signal supplied to a reset input terminal 24 can initialize the decoding process. For example, when an 8 x 8 DCT (discrete cosine transformation) block is formed, the reset signal is entered at every 64 clock pulses. There are also provided a process number setting unit 12 and a down-counter 13. If the decoding is to be conducted, for example, on an 8 x 8 DCT block, a process number "63" is set in the process number setting unit 12, for example by DIP switches. When a reset signal is supplied to a terminal RST of the down-counter 13, said down-counter 13 receives, from a terminal D, the process number set in said process number setting unit 12, then counts down said process number in synchronization with the clock pulses entered from a terminal CLK and releases the count from a terminal Q. A comparator 14 receives, at a terminal A, the count released from the down-counter 13, and, at a terminal B, the non-zero/zero-run mixed data released from the LUT 2, and releases an A < B flag of H-level, in case the input data at the terminal A is smaller than that at the terminal B. The A < B flag from the comparator 14 is supplied to an OR gate 15, which, if said flag is at H-level, forcedly shifts the non-zero/zero-run flag from the LUT 2 to the H-level, thereby causing the up-counter 8 and the OR gate 11 to handle zero-run data as non-zero data. The A < B flag from the comparator 14 is at the same time supplied to a NAND gate 16, which also receives the non-zero/zero-run flag inverted by an inverter 18 and which releases the negative logic product of the A < B flag and the inverted non-zero/zero-run flag. The output of the NAND gate 16 and the output of the OR gate 15 are subjected to logic multiplication in an AND gate 17, of which output is supplied to the AND gate group 5 whereby the zero-run data is replaced by non-zero data "0". Figs. 2A to 2G are timing charts showing an example of the function of the present embodiment. In Figs. 2A to 2G, Fig. 2A shows the clock signal; Fig. 2B the reset signal; Fig. 2C the output of the down-counter 13; Fig. 2D the non-zero/zero-run mixed data; Fig. 2E the non-zero/zero-run flag; Fig. 2F the A < B flag; and Fig. 2G the output from the data output terminal 23. At timings t and u shown in Figs. 2A to 2G, the non-zero/zero-run data becomes larger than the count of the down-counter 13, but the A < B flag is disregarded because of the non-zero state. Also if a data error occurs in the transmission channel at a timing s whereby the zero-run data varies to a value larger than the number of clock pulses required for processing the remaining DCT block prior to the detection of the EOB code, the A < B flag is shifted to the H-level, thereby forcedly shifting the non-zero/zero-run flag to the non-zero state, and replacing the zero-run data with the non-run length data "0". As explained in the foregoing, in the present embodiment, the clock pulses are counted from the initialization of the decoding process, and the obtained count is compared with the decoded run length. If, in said comparison, the decoded run length is larger than the number of clock pulses remaining before the next initialization of the decoding process, the decoded run length is replaced by "0" or by another non-run-length value. Consequently, even in case the zero-run data eventually varies to a value larger than the number of clock pulses required for processing the remaining DCT block prior to the detection of the EOB code, due to a data error occurring on the transmission channel, the non-zero/zero-run flag is forcedly shifted to the non-zero state and the zero-run data is replaced by the non-zero data "0", so that said data error does not propagate to the next DCT block. The present invention is particularly effective in the application in a decoding apparatus of so-called adaptive discrete cosine transformation (ADCT) system. The present invention is applicable, not only in the encoding of a still image but also in the encoding of a moving image. The foregoing description has been limited to the decoding of a B2 code system employing an 8 x 8 DCT, but the present invention is not limited to such embodiment and is naturally applicable easily to the decoding of other non-block encoding systems, for example variable-length encoding systems such as run-length encoding, or of other encoding systems than the B2 code. The present invention is applicable to a system composed of plural equipment such as a computer and a printer, or to a system composed of a single equipment, such as television set. Also the present invention is naturally applicable to a case in which the decoding is achieved by supplying a computer with a program. As explained in the foregoing, the present invention can provide a decoding circuit in which the data error does not propagate to succeeding images. It is to be noted that the present invention is not limited by the above-explained embodiment but is subjet to various modifications and variations within the scope of the appended claims.

Claims: A decoding apparatus comprising: receiving means (21) for receiving a variable-length code which corresponds to run-length data or non-run-length data defining pixels of an image; decoding means (1-11) for decoding the variable-length code in synchronization with a predetermined timing signal (22), to generate run-length data or non-run-length data accordingly; counting means (13) for counting the timing signal to determine the number (A) of pixels remaining to be decoded; comparing means (14) for comparing said number remaining (A) with a run length (B) defined in said run-length data; and output means (15-18) for replacing the run-length data with non-run-length data when said run length (B) exceeds the number (A) of pixels remaining to be decoded. A decoding apparatus according to claim 1, wherein said non-run-length data is "0". A decoding apparatus according to claim 1, wherein said counting means (13) is adapted to effect the counting operation for every block of a predetermined size. A decoding apparatus according to claim 3, wherein the size of said block is related to the size of an orthogonal transformation. A decoding method comprising: a receiving step for receiving a variable-length code which corresponds to run-length data or non-run-length data defining pixels of an image; a decoding step for decoding the variable-length code in synchronization with a predetermined timing signal, and generating run-length data or non-run-length data accordingly; a counting step for counting the timing signal to determine the number (A) of pixels remaining to be decoded; a comparing step for comparing a said number remaining with a run length (B) defined in said run-length data; and an output step for replacing the run-length data with non-run-length data when said run length (B) exceeds the number (A) of pixels remaining to be decoded. A decoding method according to claim 5, wherein the non-run-length data is "0". A decoding method according to claim 5, wherein the counting in said counting step is executed for every block of a predetermined size. A decoding method according to claim 7, wherein the size of said block is related to the size of an orthogonal transformation.

Inventors: ENARI MASAHIKO, ENARI, MASAHIKO, ENARI, MASAHIKO, C/O CANON KABUSHIKI KAISHA
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1993
Main classification: H04N7
IPC codes: G06T9, H04N7, H03M7