Quantizing and dequantizing circuit with reduced size

Abstract: A quantising and dequantising circuit (3) has a first memory circuit (31) with integer addresses, in which reciprocal data is stored, and a second memory circuit (32), in which a quantisation table of integers is stored. The integers stored in the second memory circuit (32) are provided to the first memory circuit (31) as address signals, causing output of the corresponding reciprocal data. Data to be quantised is multiplied by the reciprocal data output by the first memory circuit (31). Data to be dequantised is multiplied by the integers output from the second memory circuit (32).

Description: This invention relates to a quantizing and dequantizing circuit for use in, for example, a device that compresses and decompresses digitized image data. Efficient recording and transmission of digitized image data demands that the data be compressed. In one standard compression method, an image is divided into, for example, eight-by-eight pixel blocks. First, each block of pixel values is converted by a discrete cosine transformation (DCT) to spatial frequency values (DCT coefficients). The transformed data are next quantized by dividing the data by a set of values representing quantization step sizes, using different step sizes for different frequencies. The quantized data are then encoded by Huffman-type variable-length encoding, in which shorter codewords are assigned to frequently-occurring data and longer codewords to infrequently-occurring data. In decompression, this procedure is followed in reverse. Huffman decoding is used to recover the quantized data, which are next dequantized by multiplication by the same step-size values as were used in quantization. Then an inverse discrete cosine transformation (IDCT) is applied to reconstruct the pixel values. Devices that perform image compression and decompression accordingly have a circuit that performs quantization during compression and dequantization during decompression. A conventional quantizing and dequantizing circuit comprises a memory that stores a set of step-size values, a hardware divider for dividing data by these values to quantize the data, and a hardware multiplier for multiplying data by the same values to dequantize the data. A problem with this conventional circuit is that hardware multipliers and dividers are complex circuits that take up considerable space. To reduce the size and cost of the compression and decompression device, a smaller quantizing and dequantizing circuit design is desirable. A constraining factor is that while the compression procedure described above is embodied in several standards, there is no single agreed-on set of step-size values; that is, there is no single standard quantization table. To accommodate a variety of image data, the compression and decompression device needs to be able to operate with various quantization tables. It is accordingly an object of the present invention to reduce the size of a quantizing and dequantizing circuit. This object is achieved by a circuit as defined in claim 1 and a method as defined in claim 10. The invented quantizing and dequantizing circuit has a first memory circuit with integer addresses, at which are stored reciprocal data used for quantization, such as the reciprocals of the integer addresses, a second memory circuit, in which is stored a quantization table of integers, and a multiplier. When data to be quantized or dequantized are input, the integers stored in the second memory circuit are output to the first memory circuit as address signals, causing output of the corresponding reciprocal data. The multiplier multiplies data to be dequantized by the integers output from the second memory circuit. Data to be quantized are multiplied by the reciprocal data output by the first memory circuit, or by data obtained from these reciprocal data. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram illustrating a first embodiment of the invention. FIG. 2 is a block diagram illustrating a second embodiment of the invention. FIG. 3 illustrates the adding of leading and trailing zero-valued bits in the second embodiment. FIG. 4 is a block diagram illustrating a third embodiment of the invention. FIG. 5 illustrates the right shift carried out in the third embodiment. FIG. 6 is a block diagram illustrating a fourth embodiment of the invention. Embodiments of the invention will be described with reference to the attached illustrative drawings. FIG. 1 is a block diagram of an image compression and decompression device employing a first embodiment of the invention. The device comprises a DCT/IDCT processor 1 for performing the discrete cosine transformation and inverse discrete cosine transformation, a Huffman processor 2 for performing variable-length encoding and decoding, and a quantizing and dequantizing circuit 3. These elements are interconnected via a pair of tri-state buffers 21 and 22. Tri-state buffer 21 is coupled to the DCT/IDCT processor 1 by a signal line L1, and feeds data from the DCT/IDCT processor 1 to a signal line LIN in the quantizing and dequantizing circuit 3. Tri-state buffer 22 is coupled to the Huffman processor 2 by a signal line L2, and feeds data from the Huffman processor 2 to the same signal line LIN. Tri-state buffer 22 is controlled by an LDIR control signal having two states. The first state (low, or "0") designates quantization; the second state (high, or "1") designates dequantization. Tri-state buffer 22 is switched off when LDIR is in the first ("0") state, and on when LDIR is in the second ("1") state. Control signal LDIR is also coupled through an inverter 23 to tri-state buffer 21. Tri-state buffer 21 is switched on when LDIR is in the "0" state, and off when LDIR is in the "1" state. The quantizing and dequantizing circuit 3 comprises a read-only memory (ROM) 31, a read-write memory such as a random-access memory (RAM) 32, a selector 33, and a multiplier 34. The ROM 31 has integer addresses from one to N, where N is a suitable integer greater than one. The invention is not restricted to any particular value of N, but in the present embodiment N will be two hundred fifty-five. At each address n from one to N, the ROM 31 stores data representing the reciprocal 1/n of n. In this first embodiment the reciprocal data are stored in nineteen-bit fixed-point form. Table 1 shows some of the data values, giving the integer address in decimal notation, the stored reciprocal data in binary notation, and the same reciprocal data expressed in hexadecimal notation. The fixed radix point occurs after the first binary digit. The RAM 32 stores a quantization table comprising, for example, sixty-four integer values between one and two hundred fifty-five. The stored integer values need not all be different. Integer data are output from the RAM 32 on a signal line L32, and become the address input of the ROM 31. Incidentally, although quantization step sizes need not in general be integers, they can be treated as integers by using fixed-point expressions and ignoring the radix point. This technique is well known in the computing art. The output data line L31 of the ROM 31 and the output data line L32 of the RAM 32 are both coupled to the selector 33, which is controlled by the LDIR control signal. When LDIR is in the first ("0") state, the selector 33 selects reciprocal data from the ROM 31 received on signal line L31. When LDIR is in the second ("1") state, the selector 33 selects integer data from the RAM 32 received on signal line L32. The selector 33 outputs the selected data to the multiplier 34 on signal line L33. The multiplier 34 multiplies the data received on signal line L33 by the data received on signal line LIN, and outputs the resulting product to both the DCT/IDCT processor 1 and Huffman processor 2 on signal line LOUT. Signal lines L1, L2, LIN, LOUT, L31, L32, and L33 are multiple-bit signal lines, each comprising a plurality of parallel one-bit signal lines. Next the operations of quantization and dequantization will be described. Prior to either of these operations, a quantization table of integers is loaded into the RAM 32 from an external source, via signal lines not visible in the drawing. The reason for employing a read-write memory such as the RAM 32 is so that different quantization tables can be loaded as required by different image-compression standards and algorithms. For quantization, the LDIR control signal is in its first ("0") state, tri-state buffer 21 is switched on, and tri-state buffer 22 is switched off. The DCT/IDCT processor 1 receives an eight-by-eight block of pixel data to be compressed, carries out a discrete cosine transformation, and outputs the resulting sixty-four transformed data values in sequence via signal lines L1 and LIN to the quantizing and dequantizing circuit 3. In synchronization with the arrival of data on line LIN, the RAM 32 is driven by an address counter not shown in the drawing so as to output, in a fixed sequence, the integers in the stored quantization table. Each integer output by the RAM 32 is carried by signal line L32 to the ROM 31, causing the ROM 31 to output the corresponding reciprocal data on signal line L31. Since LDIR is in the first ("0") state, the selector 33 selects the reciprocal data on signal line L31 for output to the multiplier 34. The multiplier 34 multiplies the incoming data on signal line LIN by the reciprocal data on signal line L33. Since multiplication by reciprocal data 1/n is equivalent to division by the integer n, the data on signal line LIN are in effect divided by the values in the quantization table in the RAM 32, and are thereby quantized. The multiplier 34 outputs the data thus quantized on signal line LOUT to the Huffman processor 2, which compresses the quantized data by variable-length encoding. The multiplier 34 also outputs the quantized data to the DCT/IDCT processor 1, but when LDIR is in the "0" state, this input to the DCT/IDCT processor 1 is ignored. For dequantization, the LDIR control signal is in its second ("1") state, tri-state buffer 21 is switched off, and tri-state buffer 22 is switched on. The Huffman processor 2 receives compressed image data from an external source, carries out variable-length decoding, and outputs the decoded data in sequence via signal lines L2 and LIN to the quantizing and dequantizing circuit 3. In synchronization with the arriving data on signal line LIN, as before, the RAM 32 outputs integers n from its quantization table on signal line L32, and the ROM 31 outputs their reciprocals 1/n on signal line L31. This time, since LDIR is in the "1" state, the selector 33 selects the integers n on signal line L32, and the multiplier 34 multiplies the data on signal line LIN by these integers, thereby dequantizing the data. The dequantized data are output on signal line LOUT to the DCT/IDCT processor 1, which carries out an inverse discrete cosine transformation to generate decompressed pixel data. The dequantized data are also output to the Huffman processor 2, but this input to the Huffman processor 2 is ignored when LDIR is in the "1" state. In this way, the invented circuit can both quantize and dequantize data using only a multiplier 34, without requiring a divider. The divider of the prior art is replaced by the smaller and less complex ROM 31, thereby reducing the overall size of the quantizing and dequantizing circuit. Next a second embodiment will be described, in which the circuit size is further reduced by storing the reciprocal data in compressed form. This second embodiment is shown in FIG. 2, using the same reference numerals as in FIG. 1 for identical constituent elements, descriptions of which will be omitted. The differing elements are the ROM 41, which replaces the ROM 31 of FIG. 1, a new zero padder 42, and their interconnecting signal lines L41 and L42. The reciprocal data, which were stored in nineteen-bit fixed-point form in the ROM 31 in FIG. 1, are compressed to eleven bits in the ROM 41 in FIG. 2. The compression is effected by removing all leading zero-valued bits, and as many trailing bits as necessary to remove eight bits in all. Table 2 shows some of the compressed data in binary and hexadecimal form, and indicates the number of leading zero-valued bits removed. When trailing bits are removed, in some cases the resulting value is rounded up. In Table 1 there were m leading zero-valued bits in the reciprocal data at addresses from 2 m-1 + 1 to 2 m , and this is the number of leading zero-valued bits removed in Table 2. No leading zero-valued bits are removed at address one, one leading zero-valued bit is removed at address two, two leading zero-valued bits are removed at addresses three and four, three leading zero-valued bits are removed at addresses five through eight, and so on. The zero padder 42 has the function of restoring these leading zero-valued bits. Details will be given below. Next the quantizing operation of this second embodiment will be described. As in the first embodiment, the control signal LDIR is in the "0" state. The quantizing and dequantizing circuit 3 receives transformed data on signal line LIN, and the RAM 32 outputs corresponding integer data from its quantization table on signal line L32. The ROM 41 outputs the corresponding compressed reciprocal data on signal line L41. The zero padder 42 receives both the compressed reciprocal data on signal line L41 and the integer data on signal line L32. By decoding the integer data on signal line L32, the zero padder 42 can determine how many leading zero-valued bits have been removed from the reciprocal data on signal line L41. The zero padder 42 adds this number of leading zero-valued bits on the left of the compressed reciprocal data, adds as many additional zero-valued bits on the right as necessary to bring the data length to nineteen bits, and outputs the resulting uncompressed reciprocal data on signal line L42. Since LDIR is in the "0" state, the selector 33 selects the reciprocal data on signal line L42 for output on signal line L33. Subsequent operations are as in the first embodiment, the multiplier 34 multiplying the data on signal line LIN by the reciprocal data on signal line L33, and outputting quantized data for encoding by the Huffman processor 2. Dequantization is the same as in the first embodiment, because the selector 33 selects signal line L32 and does not use the reciprocal data from the ROM 41. A description of the decoding logic in the zero padder 42 will be omitted to avoid obscuring the invention with needless detail, but the operation performed by the zero padder 42 is illustrated in FIG. 3. Addresses in the ROM 41 are listed on the left in FIG. 3. To the right of each address is shown the corresponding nineteen-bit output of the zero padder 42. Within this nineteen-bit output, the eleven-bit output of the ROM 41 is shown delimited by vertical lines 43. Leading and trailing zero-valued bits added by the zero padder 42 can be seen to the left and right of these vertical lines 43. No leading zero-valued bits are added for address one, and no trailing zero-valued bits for addresses exceeding one hundred twenty-eight. Compression of the reciprocal data entails some loss of accuracy in trailing bit positions, but saves approximately two kilobits of storage space. (More precisely, 255 x 8 = 2040 bits are saved.) The reduction in size of the ROM 41 exceeds the additional space occupied by the zero padder 42, so the overall size of the quantizing and dequantizing circuit is reduced. FIG. 4 shows a third embodiment of the invention, using the same reference numerals as in FIG. 2 to denote identical constituent elements, descriptions of which will be omitted. The zero padder 42 of FIG. 2 is eliminated, the output of the ROM 41 being provided directly to the selector 33. The new elements are a shifter 51 and a second selector 52. The shifter 51 receives the outputs of the RAM 32 and multiplier 34, and shifts the output of the multiplier 34 to the right by a number of bits determined from the output of the RAM 32. The selector 52 receives the outputs of the multiplier 34 and shifter 51 and the control signal LDIR, and operates analogously to the first selector 33. The reciprocal data in the ROM 41 are compressed to eleven bits as in Table 2. The quantizing operation of this embodiment will be described next. Control signal LDIR is in the first ("0") state, so selector 33 selects the output of the ROM 41 on signal line L41, and selector 52 selects the output of the shifter 51 on signal line L51. The multiplier 34 multiplies the transformed data on signal line LIN by the compressed reciprocal data output from the ROM 41, which it receives on signal line L33 from the selector 33. FIG. 5 illustrates the right shift applied by the shifter 51 to the output of the multiplier 34, responsive to the integer output of the RAM 32. This integer output is labeled "address" in FIG. 5, since it is also the address input to the ROM 41. The right shift is by zero bits (no shift) when the address is one, by one bit when the address is two, by two bits when the address is three or four, by three bits when the address is five to eight, and so on. The shifted output of the shifter 51 is supplied through selector 52 to signal line LOUT, thence to the Huffman processor 2 for encoding. The dotted lines 53 in FIG. 5 indicate bits that are shifted out and lost. The input and output data length of the shifter 51 is the same as the output data length of the multiplier 34. (FIG. 5 is not necessarily drawn to scale.) The number of leading zero-valued bits added by the shifter 51 in FIG. 5 is the same as the number of leading zero-valued bits added by the zero padder 42 in FIG. 3. It makes no difference whether these leading zero-valued bits are added before or after multiplication. The output on signal line LOUT is the same in both cases, so the second and third embodiments produce identically quantized data. Dequantization operations in the third embodiment are the same as in the first and second embodiments, selector 33 selecting the integer data on signal line L32 and selector 52 selecting the output of the multiplier 34. FIG. 6 shows a fourth embodiment of the invention, using the same reference numerals as in FIG. 4 to denote identical constituent elements, descriptions of which will be omitted. The ROM 61, which replaces the ROM 41 of FIG. 4, stores the reciprocal data in ten-bit compressed form, omitting a single leading one-valued bit from each of the data values in Table 2. Table 3 indicates the data stored in the ROM 61 in binary and hexadecimal form, and shows the removed leading bits in binary form. A logic-one node 62 provides a constant "one" (high) logic-level potential, to take the place of these leading one-valued bits. The ROM 61 outputs ten bits of compressed reciprocal data as shown in Table 3 on signal line L61. The logic-one node 62 adds a leading one-valued bit on signal line L62. In quantization (when LDIR = "0"), the selector 33 selects these eleven bits on signal lines L61 and L62 and provides them on signal line L33 to the multiplier 34. Further quantization operations are as in the third embodiment. Dequantization operations are as in the first, second, and third embodiments, selectors 33 and 52 selecting the integer data on signal line L32 and the multiplier output on signal line L34, respectively. By eliminating two hundred fifty-five bits from the ROM 61, the fourth embodiment further reduces the size of the quantizing and dequantizing circuit. The invention is not restricted to the preceding embodiments, but permits numerous modifications. For example, the ROM 41 in the second embodiment can be modified to store data in the same ten-bit compressed form as the ROM 61 in the fourth embodiment. The zero padder 42 must then be provided with a logic-one node to add a leading one-valued bit, as in the fourth embodiment, before the leading zero-valued bits are added. The read/write memory that stores the quantization table need not be a random-access memory. A sequential-access memory can be employed. So-called flash memory can be employed. Those skilled in the art will recognize that various other modifications can be made without departing from the scope claimed below.

Claims: A quantizing and dequantizing circuit for quantizing first data and dequantizing second data, comprising: a first memory circuit (31, 41, 61) addressable by integer addresses, for storing, at each address, reciprocal data for quantizing said first data, and providing output of said reciprocal data responsive to address input; a second memory circuit (32) for storing a quantization table of integers, and providing output of said integers as said address input to said first memory circuit; and a multiplier (34) coupled to multiply said second data by the integers output from said second memory circuit (32), multiply said first data by reciprocals of said integers obtained from the reciprocal data output by said first memory circuit (31, 41, 61), and provide output of resulting products. The circuit of claim 1, wherein said reciprocal data is represented by a reciprocal of said integer address. The circuit of claim 1, wherein said first memory circuit (31, 41, 61) is a read-only memory circuit and said second memory circuit (32) is a read-write memory circuit. The circuit of claim 1, wherein said first memory circuit (31) stores said reciprocal data in fixed-point form. The circuit of claim 1, wherein said first memory circuit (41) stores said reciprocal data in a compressed form with leading zero-valued bits removed, further comprising: a zero padder (42), coupled to add leading zero-valued bits to the output of said first memory circuit (41) in a quantity responsive to the output of said second memory circuit (32), before said output of said first memory circuit (41) is furnished to said multiplier (34). The circuit of claim 1, wherein said first memory circuit (41) stores said reciprocal data in a compressed form with leading zero-valued bits removed and with a single leading one-valued bit removed, further comprising: a zero padder (42), coupled to add a single leading one-valued bit to the output of said first memory circuit (41), then also add leading zero-valued bits in a quantity responsive to the output of said second memory circuit (32), before said output of said first memory circuit (41) is furnished to said multiplier (34). The circuit of claim 1, further comprising a first selector (33) controlled by a control signal having a first state indicating quantization and a second state indicating dequantization, coupled to furnish the output of said first memory circuit to said multiplier (34) when said control signal is in said first state, and furnish the output of said second memory circuit (32) to said multiplier (34) when said control signal is in said second state. The circuit of claim 7, wherein said first memory circuit (41, 61) stores reciprocal data in a compressed form with leading zeros removed, further comprising: a shifter (51), coupled to right-shift the output of said multiplier (34) by a number of bits responsive to the output of said second memory circuit (32), and output shifted data; and a second selector (62), controlled by said control signal, coupled to select the shifted data output by said shifter (51) when said control signal is in said first state, and the output of said multiplier (34) when said control signal is in said second state. The circuit of claim 8, wherein said first memory circuit (61) stores reciprocal data in a compressed form with leading zero-valued bits removed and with one leading one-valued bit removed, further comprising: a logic-one node (62), coupled to add one leading one-valued bit to the output of said first memory circuit (61), before said output of said first memory circuit (61) is furnished to said multiplier (34). A method of quantizing first data and dequantizing second data, comprising the steps of: storing, in a first memory circuit (31, 41, 61) addressable by integer addresses, reciprocal data for quantizing said first data; storing, in a second memory circuit (32), a quantization table of integers; providing the integers stored in said second memory circuit (32) to said first memory circuit (31, 41, 61) as address signals, thereby causing output of corresponding reciprocal data; multiplying said first data by reciprocals of said integers obtained from said reciprocal data, thereby generating quantized data; and multiplying said second data by the integers output by said second memory circuit (32), thereby generating dequantized data. The method of claim 10, wherein said reciprocal data is represented by a reciprocal of said integer address. The method of claim 10, wherein said first memory circuit (31, 41, 61) is a read-only memory circuit and said second memory circuit (32) is a read-write memory circuit. The method of claim 10, comprising the further steps of: generating a control signal having a first state indicating quantization and a second state indicating dequantization; and selecting output of said first memory circuit (31, 41, 61) or output of said second memory circuit (32) responsive to said control signal. The method of claim 10, wherein said first memory circuit (31) stores said reciprocal data in fixed-point form. The method of claim 10, wherein said first memory circuit (41) stores reciprocal data in a compressed form with leading zero-valued bits removed. The method of claim 15, comprising the further step of adding leading zero-valued bits to the output of said first memory circuit (41) in quantities responsive to the integers output by said second memory circuit (32). The method of claim 15, comprising the further step of right-shifting said quantized data by amounts responsive to the integers output by said second memory circuit (32). The method of claim 10, wherein said first memory circuit (41, 61) stores reciprocal data in a compressed form with leading zero-valued bits removed and with a single leading one-valued bit removed, comprising the further step of: adding a single leading one-valued bit to the output of said first memory circuit (41). The method of claim 18, comprising the further step of adding leading zero-valued bits to the output of said first memory circuit (41) in a quantity responsive to the integers output by said second memory circuit (32). The method of claim 18, comprising the further step of right-shifting said quantized data by a number of bits responsive to the integers output by said second memory circuit (32).

Inventors: KOMOTO EIJI, KOMOTO, EIJI, KOMOTO, EIJI, C/O OKI ELEC. IND. CO. LTD.
Applicants: OKI ELECTRIC IND CO LTD, OKI ELECTRIC INDUSTRY CO., LTD.
Application year: 1994
Main classification: H04N1
IPC codes: H03M7, H04B14, H04N7, G06T9, H04N1