Switching theoretic approach to image compression

Switching theoretic approach to image compression

SIGNAL PROCESSING Signal Processing 44 ( 1995) 243-246 Fast Communication Switching theoretic approach to image compression Jacob Augustine a, Wen ...

393KB Sizes 0 Downloads 48 Views

SIGNAL

PROCESSING Signal Processing 44 ( 1995) 243-246

Fast Communication

Switching theoretic approach to image compression Jacob Augustine a, Wen Feng b, Anamitra Makur a, James Jacob a-* a Department of Electrical Communication Engineering, Indian Institute of Science, Bangalore 560 012. India h Department of Electrical Engineering, Anhui Mechanical and Electrical Institute, Wuhu, Anhui 241 000, China

Received 13 March 1995

Abstract A novel approach for the lossless compression of monochrome images using switching theoretic techniques is presented. Bit planes of the image are divided into blocks and converted to Boolean switching functions. Compression is performed by finding a minimal representation for each switching function. The method compares well with JPEG in terms of compression ratio. Keywords: Image compression: Block coding; Switching theory

1. Introduction The purpose of this paper is to introduce a novel lossless compression scheme for images using switching theoretic techniques. The technique called logic coding, reported in our earlier work [ 11 on binary im-

ages is modified and applied on the bit planes [ 8,101 of monochrome images. After preprocessing, the image is split into bit planes and each bit plane is divided into smaller blocks. Blocks containing both black and white pixels are converted to Boolean switching functions and a Boolean function minimization algorithm is applied to represent each function in a compact way, leading to possible data compression. To decode the data coded using the switching theoretic technique, a reverse scheme has been devised. In this work, we have employed a two-level Boolean ( logic) function minimization approach to find the minimal representation of a switching function. Twolevel logic minimization seeks a sum of products rep* Corresponding author. E-mail: [email protected]. 016%1684/95/$9.50

@ 1995 Elsevier Science B.V. All rights reserved

SSDIO165-1684(95)00047-X

resentation for a given switching function with minimum number of implicants (product terms) and literals [ 31. Our technique compares well with the lossless mode of JPEG [ 91 in terms of compression ratio. Presently the compression is rather slow, whereas the decompression is relatively faster.

2. The compmsion

scheme

We first define a few important terms required for explaining our compression scheme. A Boolean switching function F is a mapping F : BN -+ B, where B = {O,l}. In the truth table of a switching function of N variables, there are 2N rows. Each of these rows which represents an input state vector is called a minterm. In a switching function, the ON-set is the set of minterms whose outputs are mapped to 1 and the OFF-set is the set of minterms whose outputs are mapped to 0. A cube is an N-tuple A = where ai E (0, 1, X}. The dimension {Ul,U29 -**9 a~}, of the cube is the number of Xs in it. An a cube has

244

J. Augusrine et al./Signal

2” minterms (zero cubes) within it. Cube A subsumes cube B (denoted as A 5 B) , if all minterms of A are contained in B [ 21. We define compression ratio as total input bytes - total output bytes total input bytes

x 100%.

Processing

44 (1995) 243-246

duce the number of transitions between OS and 1s on the bit planes. Gray coding increases the probability of all-black and all-white blocks on the bit planes [ 81 and has experimentally been found to be beneficial.

(1) 2.2. Function generation and logic coding of mixed

Consider an image where the intensity is represented by k-bits. By selecting a single bit from the same position in the binary representation of each pixel, k binary images called bit planes can be generated [ 8,101. The bit planes are divided into blocks of size n x m pixels. Blocks are classified into three types namely, all-black, all-white and mixed (combination of black and white pixels). Two bit codes are assigned for the first two types, whereas we attempt to compress the mixed type block by applying switching theoretic techniques. For a particular block if the technique fails to yield compression, the pixels are stored as such. Thus four possibilities arise: 00: all-black block. 01: all-white block. 10: followed by the bits for the minimal two-level representation of the function for the block (number of bits < nm). 11: followed by nm bits of the block if the compression technique fails. Our approach of first dividing the bit planes into smaller blocks is similar to Block coding for graphics developed by Kunt and Johnsen [ 81. In Block coding the all-white and all-black blocks are represented by l-bit or 2-bit long prefix codes, whereas the nm bits of the mixed type block are stored directly after a 2bit prefix code. We further attempt to compress mixed blocks, and hence our approach should perform better. Recent work on Block coding in combination with arithmetic coding for binary images is found in [ 61.

blocks In our switching theoretic approach, a mixed block is converted to a Boolean switching function of log, nm variables treating the binary value of the nm pixels as its output. We have chosen integer powers of 2 for n and m values. Truth table of the switching function is generated for a block by assigning the pixels to minterms according to Gray code, such that geometrically adjacent pixels are mapped to logically adjacent minterms. This assignment helps in minimization since any cluster of 2” logically adjacent minterms combine to form a single a-cube. Blocks are scanned row wise with a reversal of the direction for adjacent rows (as shown in Fig. 1 (a)), to ensure that pixels at the ends of consecutive lines are mapped to logically adjacent minterms. Fig. 1 shows the conversion of a block with 32 pixels into a 5 variable switching function according to the scheme. A block of mixed type from a bit plane is shown in Fig. 1 (a). Fig. 1 (b) illustrates the assignment of minterms to

ON-set

Gray code

2.1. Preprocessing the image

#O

1000;

It is possible that not all 256 intensity levels appear in any given image. We have introduced an additional preprocessing step of recoding the intensity levels wherein the actual intensity values appearing in an image are arranged contiguously by assigning successive integer values from 0 onwards to them. However, a 256-bit overhead is incurred to indicate which intensity levels are present and which are absent. The recoded intensity levels are further Gray coded to re-

1ooob

= 5

0

#1=2

1

#X = 3

b) Switching

xoxoi

0x001

e) Alphabet count

d) Minimized

for OFF-set

OFF-set

function 0-010-111-x

total bits = 5 + ( 2 + 3 ) 2 + overheads = 22 l

f) Code allotment and total bits Fig. 1. Function

generation

and logic coding.

J. Augustine

block type Jl 2 bits

no. of cubes

ON-set/OFF-set Al 1 bit

et al. /Signal

4 l/2 bits

-D--B.

p bits

! allotment of prefix codes Fig. 2. Format of encoded

li encodedcubes block

the pixels which generates the truth table of the function. Figs. 1 (c) and 1 (d) show the minimized ON-set and OFF-set cubes of the function, respectively. The well known two-level cube based logic minimizer ESPRESSO [ 31 was used for function minimization. The set with lesser number of cubes is chosen from between the ON-set and OFF-set for coding, which is indicated by an additional bit in the header. A prefix code is used for symbols 0,l and X of a cube. Three alternative such prefix codes are available and the most appropriate one is chosen adaptively for each block. A prefix code of one or two bits in the block header specify the particular prefix code used. It can be shown that for this scheme, the number of bits required to represent C cubes of N variables is upper bounded by ( $CN + overhead bits). Fig. 1 (e) shows the alphabet count in the OFF-set and Fig. l(f) the code assignment as well as the number of bits required in compressed form. Representing picture information in the form of minimized cubes is tentatively named as logic coding. Fig. 2 shows the general format of a block in encoded form. For all-black and all-white blocks only the first two bits are present. Depending on the block size an upper limit called C,,,,, can be computed for the number of cubes, beyond which the technique leads to data expansion. The value of p indicating the number of minimized cubes varies with C,, and ranges between 2 and 4 bits in our experiment. 2.3. Decoding of logic coded blocks Decoding of logic coded blocks is done by computing the value of the function for each of its possible minterms (following the Gray code), using the cube subsuming operation and assigning the values to the corresponding pixels of the block. If a minterm subsumes any cube of the minimized ON (OFF)-set of a block, then the pixel corresponding to the minterm evaluates to 1 (0).

Processing

3.

44 (1995) 243-246

Experimental

245

results

Compression and decompression algorithms have been implemented in C language on an IBM RS6000/580 workstation and tested on standard images girl, mandrill (baboon) and boats, each of size 256 x 256 pixels and 8 bits per pixel. Logic minimization was done using ESPRESSO 2.1. Table 1 gives the results of the compression experiment as well as a comparison with the lossless mode of JPEG using the PVRG-JPEG (Portable Video Research Group, Stanford University) Codec. 1.1. In this experiment, different block sizes starting from 16 x 16 downto 4 x 4 have been tried for each bit plane and the compression ratio and CPU time reported are for the best results obtained. We are currently investigating the hierarchical division of bit planes employing a quadtree structure, to eliminate the need for experimenting with different block sizes. The compression time includes the preprocessing time as well. The CPU time reported for the compression is presently rather high. It is primarily due to the fact that ESPRESSO is used as a stand alone package and considerable communication and file manipulation overheads are incurred. PVRGJPEG was run in its lossless mode with all the seven available predictor types and the minimum and maximum compression ratios obtained are reported in Table 1. The compression ratio achieved through our technique is comparable to JPEG. As the cube subsuming operation is relatively simple, the time required for decompression is significantly less compared to the compression time and comparable to JPEG.

Table 1 Experimental

results

Image

Method

Compr. ratio (%)

Compr. time (sec.)

Decompr. time (sec.)

Girl

Logic coding PVRG-JPEG Logic coding PVRG-JPEG Logic coding PVRG-JPEG

39.9 30.7-38.1 11.6 6.7-13.7 27.9 24.9-33.1

51.7 < 0.5 99.1 < 0.5 65.1 < 0.5

1.9 <0.5 2.3 <0.5 2.3 <0.5

Mandrill Boats

246

4. Conclusions

J. Augustine et al. /Signal Processing 44 (1995) 243-246

and future directions

A novel lossless data compression technique for monochrome images using switching theoretic techniques has been presented. Performance of our technique is comparable to JPEG in terms of compression ratio, even though we have not employed any decorrelation method on the image. The execution time of the compression scheme is rather high at present, which is expected to improve with further effort. However, the results of our preliminary investigations point to the possibility of using switching theoretic techniques as an effective tool for digital image compression. Possible directions for further work are pointed out below. It is well known that the minimum two-level sum of product description is not the most compact representation for all switching functions. Alternative representations such as Binary Decision Diagrams (BDDs) [ 51, multi-level logic equations [ 41, Finite State Machine models [ 21, etc., can often lead to more compact representations. For example, a parity function of N variables requires 2’-’ cubes in the minimum two-level representation (which lead to expansion) whereas the BDD and multi-level logic equations for this function are extremely compact with complexity linear in the number of variables [ 51. The best compression scheme will be one in which the different possible representations of a function are obtained and the optimal one chosen for each block of a bit plane. This can significantly improve the compression ratio at the cost of additional computation. Another direction for further work is the devising of a suitable decorrelation scheme (as a pre-processing step) that best suits our coding technique. DPCM based techniques (as used in JPEG) which aim to make the histogram more peaked need not give the best results for our scheme, though they lower the

average entropy per source symbol [7]. One needs to devise a simple and reversible Boolean transform which when applied to a switching function, makes it more amenable for minimization. Our technique can also be extended to lossy compression by suitable addition of don’t-cares to the switching functions. We are currently investigating some of these issues. References [ 1] J. Augustine, W. Feng and J. Jacob, “Logic minimization based approach for compressing image data”, Pmt. 8th Internat. Conf: on VLSI Design, New Delhi, India, 4-7 January 1995, pp. 225-228 (Proceedings available from IEEE Computer Society Press, Order Number 6905-02). [2] N.N. Biswas, Logic Design Theory, Prentice Hall, Englewood Cliffs, NJ, 1993. [3] R.K. Brayton, G.D. Hachtel, C.T. McMullen and A.L. Sangiovanni-Vincentelli, Logic Minimization Algorithms for VLSI Synthesis, Kluwer Academic Publishers, Boston, 1984. [4] R.K. Brayton, G.D. Hachtel and A.L. SangiovanniVincentelli, “Multi-level logic synthesis”, Froc. IEEE, Vol. 78, No. 2, February 1990, pp. 264-300. [ 51 R.E. Bryant, “Symbolic Boolean manipulation with ordered binary-decision diagrams”, ACM Computing Surveys, Vol. 24, No. 3, September 1992, pp. 293-318. [6] P F&d, “A fast and efficient compression method for binary images”, Signal Processing: Image Communication, Vol. 6, No. 1, March 1994, pp. 69-76. [7] N.S. Jayant and P. NOR, Digital Coding of Waveforms: Principles and Applications to Speech and Video, PrenticeHall, Englewood Cliffs, NJ, 1984. [ @]M. Kunt and 0. Johnsen, “Block coding of graphics: A tutorial review”, Proc. IEEE, Vol. 68, No. 7, July 1980, pp. 770-786. [9] W.B. Pennebaker and J.L. Mitchell, JPEG Still Image Compression Standard, Van Nostrand Reinhold, New York, 1993. [lo] T.W. Schwartz and R.C. Barker, “Bit-plane encoding: A technique for source encoding”, IEEE Trans. Aerospace Electron. Systems, Vol. AES-2, July 1966, pp. 385-392.