Abstract:
The present invention relates to a method of and an apparatus for scanning an N×N image signal in a particular direction depending upon an energy distribution of the two-dimensional data. The invention involves scanning image signal transform coefficients of an N×N block using a slope determined on the basis of the energy distribution pattern, the blocks being defined by transforming an input image signal of a time domain to signals of a frequency domain, compressing and transferring the scanned transform coefficients, restoring the compressed transform coefficient data and rearranging the restored coefficient data into original image data of N×N blocks by scanning them in conformance with the energy distribution pattern.

Description:
FIELD OF THE INVENTION 
     The present invention relates to a coding and decoding device for a digital image signal processing system, and more particularly to a method and apparatus for scanning image data in various ways depending upon an energy distribution of two-dimensional data, which can effectively compress image data. 
     BACKGROUND OF THE INVENTION 
     Typically, in such a digital image processing system, a compression of the digital image signal band is performed in order to improve an image signal transferring efficiency. Such a compression of the digital image signal is substantially executed in such a way that an image signal input in the time domain is transformed into the frequency domain. As a result, most of the image energies are condensed into some of the transform coefficients of each N×N block (where N is a positive integer). The transform coefficients of relatively low energy are converted to zero (&#34;0&#34;) by comparing the coefficients with a predetermined threshold value so as to extend the number of &#34;0&#34; valued coefficients as much as possible. The coefficients are then converted into a serial data stream by way of a fixed scanning method such as a zigzag scanning method, in which a constant scanning slope of &#34;1&#34; is used. That is, the number of zero-valued transform coefficients (i.e., runlength) is counted to transfer a column (runlength, amplitude) of the image data. An end of block (EOB) bit follows the last non-zero valued transform coefficient in the block. The zero-valued coefficients following the last non-zero valued transform coefficient are not considered as practical data and only the number of zero-valued coefficients is transferred to establish the desired data compression. The data is compressed from its original form because only the coefficients having a non-zero value are transferred. The scanning of the image data to form the data stream is effected by using a fixed slope zigzag scanning method as previously described. FIG. 1 illustrates an example of the zigzag scanning method, in which N is set to eight transform coefficients and numerals in the block denote the scanning order. 
     In FIG. 1, the transform coefficients are partially distributed in a horizontal, vertical or diagonal direction in accordance with the input image pattern. For this reason, when the image data is scanned by the fixed-slope zigzag scanning method, the EOB bit located after the last non-zero valued coefficient is not produced as quickly as possible. Specifically, the fixed slope zigzag scanning method will produce the EOB bit as quickly as possible only for one particular energy distribution of transform coefficients, the distribution in which the non-zero valued coefficients are located in the shaded area of FIG. 4C and the zero-valued coefficients are located in the non-shaded area. This is because this particular input distribution corresponds exactly with the zigzag scanning method. For other types of input patterns, (e.g. FIGS. 4A, 4B, 4D and 4E), however, the conventional zigzag scanning method which always uses a slope of &#34;1&#34; will not correspond exactly with the input patterns. This causes a problem in that the data compressing efficiency for these other input patterns is likely to be limited-because the number of zero valued coefficients which follows the EOB bit is also transferred to compress the image data. The transferring efficiency is maximum when only the non-zero valued coefficients are transferred. 
     SUMMARY OF THE INVENTION 
     Accordingly, an object of the present invention is to provide an image processing technique which can properly select the scanning direction to produce the EOB (end of block) bit as quickly as possible, during formation of the digital data stream, thus improving the band compressing efficiency. 
     Specifically, it is an object of the invention to not be confined to always using the zigzag scanning (slope of &#34;1&#34;) technique but to instead vary the slope of the scanning depending on the input data pattern. Thus, an optimum transferring efficiency can always be obtained. 
     To achieve the above object, according to an aspect of the present invention, there is provided a method of scanning image data which makes use of a distribution in energy of the two-dimensional data, comprising the steps of: scanning image signal transform coefficients of N×N blocks on the basis of the energy distribution pattern, the blocks being defined by transforming the input image signal in the time domain to signals of the frequency domain, compressing and transferring the scanned transform coefficients; and, restoring the compressed transform coefficient data and rearranging the restored coefficient data into original image data of N×N blocks by scanning them in conformance with the energy distribution pattern. 
     According to another aspect of the present invention, there is provided an apparatus for scanning image data using a distribution of energy of the two-dimensional data, comprising: an encoder for transforming input image signals of the time domain into signals of the frequency domain, scanning the transform coefficients of each N×N block in accordance with the energy distribution pattern, and compressing and transferring the scanned transform coefficients; and, a decoder for restoring the compressed data transferred from the encoder and rearranging the transform coefficients into original image data of N×N blocks in conformance with the scanning order based on the energy distribution pattern. 
     The above and other objects, features and advantages of the invention will be apparent from the following description taken with reference to the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a view showing an example of a conventional scanning method; 
     FIG. 2 is a block diagram of an exemplary construction of an encoding unit employed with a scanning device according to the present invention; 
     FIG. 3 is a block diagram of an exemplary construction of a decoding unit employed with a scanning device according to the present invention; 
     FIGS. 4A through 4E are views showing exemplary image energy distribution patterns of arbitrary transform coefficients; 
     FIG. 5 is a view illustrating slopes in a scanning direction of image energy distribution; and, 
     FIGS. 6A through 6D are views illustrating scanning orders according to the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Now, a preferred embodiment of the present invention will be described in detail. 
     Referring to FIG. 2, an example of an encoder employed with a scanning device according to the present invention is shown. In the drawing, a two-dimension (2D) transform portion 1 transforms a digital input image signal into transform coefficients of an N×N block in the frequency domain, where N is a positive integer representing a certain number of transform coefficients. The image input signal is considered as an error component estimated through a differential pulse code modulation (DPCM) loop. A transform coefficient storage portion 2 stores the transform coefficients output of the 2D transform portion 1 in accordance with an output signal of a write address counter 3. The transform coefficient storage portion 2 may be preferably embodied by a video RAM. An energy slope classification portion 4 identifies the energy distribution pattern of the N×N block of transform coefficients supplied from the 2D transform portion 1 and outputs m-bit slope data corresponding to the slope of each of the N×N block patterns. A scan order decision portion 5 stores 2 m  scan orders corresponding to the slope data and selectively outputs the scan order corresponding to the m-bit slope data supplied from the energy slope classification portion 4 to the transform coefficient storage portion 2. More specifically, the scan order decision portion 5 has addresses for the different 2 m  scan orders and outputs any one address corresponding to the m-bit slope data outputted from the energy slope classification portion 4 so as to sequentially read out the transform coefficients stored in the transform coefficient storage portion 2 in accordance with the scan order read out from the scan order decision portion 5. Preferably, the scan order decision portion 5 is formed from a read only memory (ROM). 
     A data compression portion 6 quantizes the transform coefficients sequentially outputted in accordance with the address supplied from the scan order decision portion 5 and compresses the quantized transform coefficient data by using a variable length coding technique. The data compression portion 6 has a buffer built therein and chooses a quantization step size in accordance with the fullness state of the buffer. 
     A multiplexer 7 selectively outputs the compressed data supplied from the data compression portion 6 and the slope data from the energy slope classification portion 4. 
     FIG. 3 shows a block diagram of an exemplary decoding unit or decoder employed with a scanning device according to the present invention. In the drawing, a demultiplexer 11 classifies the compressed data and the slope data from the output data of the multiplexer 7 shown in FIG. 2, and a data restoring portion 12 restores the data compressed by the data compression portion 6 (FIG. 2) into an original transform coefficient data. A scan order decision portion 13 has 2 m  scan order data stored therein and selectively outputs the scan order corresponding to the m-bit slope data classified by the demultiplexer 11 to a transform coefficient storage portion 14. More specifically, the scan order decision portion 13 has addresses for the different 2 m  scan order data and selectively outputs any one address corresponding to the m-bit slope data outputted from the demultiplexer 11 to the transform coefficient storage portion 14. The scan order decision portion 13 is preferably formed of a ROM. The transform coefficient storage portion 14 rearranges the transform coefficients outputted from the data restoring portion 12 in accordance with the address of the scan order decision portion 13 into the transform coefficients of an N×N block and stores the rearranged transform coefficients. The transform coefficient storage portion 14 sequentially outputs the rearranged transform coefficients in accordance with the address supplied from a read address counter 15. The inverse transform coefficient storage portion 14 is preferably formed of a video RAM. 
     A two-dimensional inverse transform portion 16 converts the transform coefficients outputted from the transform coefficient storage portion 14 into an original time domain image signal (i.e., digital input image or error component estimated through a DPCM loop). 
     Now, the method of and apparatus for scanning image data using a two-dimensional data energy distribution will be described in detail. 
     In FIG. 2, the digital input image or image input signal considered as the estimated error component passed through a DPCM loop is converted to the transform coefficients of an N×N (for example, N in this example is set to eight) block of the frequency domain by the 2D transform portion 1. The transform coefficients output from the 2D transform portion 1 are stored into the transform coefficient storage portion 2 in accordance with the address signal supplied from the write address counter 3. 
     Further, the transform coefficients supplied from the 2D transform portion 1 are input to the energy slope classification portion 4 which identifies the transform coefficient energy distribution pattern of the block of N×N coefficients and outputs m-bit slope data according to the energy distribution data of the block of N×N coefficients thus identified. 
     FIGS. 4A through 4E are views showing various examples of image energy distribution patterns for arbitrary transform coefficient arrays (N×N) in which oblique line portions denote energy distribution patterns. More specifically, in FIG. 4A the transform coefficient energy is horizontally distributed at an upper area of the block. 
     FIG. 4B shows a case in which the transform coefficient energy pattern outputted from the 2D transform portion 1 is generally horizontally distributed but slightly inclined to the left of the block. FIG. 4C illustrates an example of the transform coefficient energy distributed in a diagonal direction of the block. Also, FIG. 4D shows a case in which the transform coefficient energy is generally vertically distributed but slanted to the upper side of the block. FIG. 4E denotes an example of the transform coefficient energy vertically distributed at the left side of the block. 
     More specifically, the energy slope classification portion 4 classifies the energy distribution pattern of the transform coefficients outputted from the 2D transform portion 1 into one of 2 m  slopes and outputs the classified energy distribution pattern as m-bit slope data. In this case, as the number of bits making up the slope information is increased, the compression efficiency can be improved. But, the slope information must be transferred to a decoder so as to be employed in decoding the encoded data. Therefore, it is undesirable to increase the number of bits of slope data without limitation. Preferably, the slope data is set to three or four bits. 
     FIG. 5 shows the various slopes in scanning direction. If the transform coefficient energy distribution pattern as shown in FIG. 4A is outputted from the 2D transform portion 1, then the slope data SCAN 1 in FIG. 5 is produced by the energy slope classification portion 4. If the energy distribution pattern shown in FIG. 4B is obtained from the 2D transform portion 1, then the slope data SCAN 2 as shown in FIG. 5 is obtained. 
     Similarly, when the energy of the transform coefficients outputted from the 2D transform portion 1 is distributed in a pattern shown in FIG. 4C, the energy slope classification portion 4 outputs a slope data SCAN 2 m  /2 in FIG. 5. This is the same slope that the conventional device uses for every input energy distribution, the slope of &#34;1&#34; or 45°. 
     Alternatively, when the energy pattern is obtained as shown in FIG. 4E, the slope data SCAN 2 m  is produced by the energy slope classification portion 4. 
     The scanning order storage portion 5, in which the 2 m  sets of scanning order data are previously stored, selects one scanning order according to the m-bit slope data supplied from the energy slope classification portion 4 and outputs an address corresponding to the selected scanning order. The address signal thus produced serves as a read address for the transform coefficient storage portion 2. Accordingly, the transform coefficients stored in the transform coefficient storage portion 2 are sequentially outputted in accordance with the address signal (i.e., read address) supplied from the scanning order storage portion 5. That is, if the energy distribution of the transform coefficient outputted from the 2D transform portion 1 is in a pattern shown in FIG. 4A, then the energy slope classification portion 4 outputs the m-bit slope information SCAN 1 and the scanning order decision portion 5 produces an address according to the m-bit SCAN 1 slope data to read the transform coefficients stored in the transform coefficient storage portion 2. 
     In other words, the transform coefficients stored in the transform coefficient storage portion 2 are read in accordance with the read address supplied from the scanning order decision portion 5 in the order shown in FIG. 6A in which numerals denote the scanning order. 
     While the energy distribution of the transform coefficients in the 2D transform portion 1 is in a pattern shown in FIG. 4B, the energy slope classification portion 4 produces the m-bit slope data SCAN 2 in FIG. 5, and the scanning order decision portion 5 thus outputs the address corresponding to the m-bit slope data SCAN 2 so as to read the transform coefficients stored in the transform coefficient storage portion 2. Namely, the transform coefficients stored in the storage portion 2 are read in the order shown in FIG. 6B under the read address supplied from the scanning order decision portion 5. In FIG. 6B numerals denote the scanning order. 
     Assuming that the energy of the transform coefficients outputted from the 2D transform portion 1 is distributed in a pattern shown in FIG. 4C, the energy slope classification portion 4 outputs the m-bit slope data SCAN 2 m  /2 in FIG. 5 and the scanning order decision portion 5 produces the address corresponding to the m-bit slope data SCAN 2 m  /2 so as to read the transform coefficients in the transform coefficient storage portion 2. In this case, the transform coefficients in the transform coefficient storage portion 2 are read in the order (zigzag scanning) described in FIG. 1 by the read address supplied from the scanning order decision portion 5. 
     Furthermore, when the energy distribution of the transform coefficients is in a pattern in FIG. 4D, the energy slope classification portion 4 outputs an m-bit slope data SCAN 2 m  -1 in FIG. 5 and the scanning order decision portion 5 thus produces an address corresponding to the m-bit slope data SCAN 2 m  -1 to read the transform coefficients stored in the transform coefficient storage portion 2 in the order illustrated in FIG. 6C in which numerals denote the scanning order. Alternatively, if the distribution in energy of the transform coefficients is in a pattern shown in FIG. 4E, the energy slope classification portion 4 outputs an m-bit slope data SCAN 2 m  and the scanning order decision portion 5 produces an address corresponding to the slope data so as to read the transform coefficients in the transform coefficient storage portion 2 in the order illustrated in FIG. 6D in which numerals denote the scanning order. 
     The transform coefficients thus read are entered into the data compression portion 6 where the coefficients are quantized and subjected to variable length coding to achieve a desired data compression. Of course, the data outputted from the data compression portion 6 includes the column (runlength, amplitude) defined by a size of an amplitude and the number of zero valued coefficients between the coefficients, and an EOB bit. Therefore, the EOB bit can be rapidly obtained as compared with using only the zigzag scanning order. 
     The multiplexer 7 functions to selectively output the compressed data from the data compression portion 6 and the m-bit slope data from the energy slope classification portion 4. 
     The data compressed by the encoder of FIG. 2 is entered to the decoder shown in FIG. 3. More specifically, the compressed data is first entered to a demultiplexer 11 in the decoder, which separates the compressed data and the slope data outputted from the multiplexer 7 of FIG. 2. The data restoring portion 12 restores the compressed data to original data (transform coefficients). The scanning order decision portion 13 receives the m-bit slope data separated by the demultiplexer 11 and selects a scanning order corresponding to the slope data from the 2 m  scanning orders previously stored therein. The scanning order thus selected is supplied to the transform coefficient storage portion 14. Consequently, the transform coefficients outputted from the data restoring portion 12 are rearranged to the transform coefficients of an N×N block on the basis of the address supplied from the scanning order decision portion 13 and stored in the storage portion 14. The transform coefficients stored in the storage portion 14 are sequentially outputted in accordance with the address supplied from the read address counter 15. Subsequently, the transform coefficients are supplied to the 2D inverse transform portion 16 which transforms the signal back into the time domain, so as to obtain the original signal (digital input image or error component estimated through the DPCM loop). 
     As described above, when the transform coefficients are distributed slantwise in any one direction according to the image pattern, the scanning direction is selected in conformance with this distribution of the transform coefficients so as to quickly obtain the EOB bit. As a result, the image data can be compressed effectively, thereby improving the compressed data transferring efficiency. 
     The present invention has been described with respect to energy distribution classified with respect to a linear function, but it may be considered that the energy distribution is classified in a non-linear pattern. 
     Although the present invention has been described with respect to a specific embodiment, it will be understood that various changes and modifications may be made therein without departing from the scope and spirit of the invention.