PIECEWISE UNIFORM SWITCHED VECTOR QUANTIZATION OF THE MEMORYLESS TWO DIMENSIONAL LAPLACIAN SOURCE Zoran H. Peric, Ivana Lj. Tosic Faculty of Electronic Engineering, University of Nis, Serbia, Yugoslavia e-mail peric@elfak.ni.ac.yu abstract: In this paper we will present a simple and complete asymptotical analysis of an optimal piecewise uniform quantization of two-dimensional memoryless Laplacian source with the respect to distortion (D) i.e. the mean-square error (MSE). Piecewise uniform quantization consists of L different uniform vector quantizers. Uniform quantizer optimality conditions and all main equations for number of optimum number of output points and optimal number of levels for each partition are presented (using rectangular cells). We derive the optimal granular distortion D gopt (i) for each partition in a closed form. Switched quantization is used in order to: give higher quality by increasing signal-to-quantization-noise-ratio (SQNR) in a wide range of signal volumes (variances) or to decrease necessary sample rate. Key words: piecewise uniform quantization, switched quantization, distortion Introduction The use of digital representation for audio, speech, images and video is rapidly growing with the exploding use of computers and multimedia computer applications. To provide a more efficient representation of data, many compression algorithms have been developed, and in the heart of all these algorithms is quantization. The concept of quantization is a mapping of a large set of amplitudes of infinite precision to a smaller finite set of values, as shown in the Figure 1(a). Vector quantization is simply an extension of the scalar quantization to multidimensional spaces; that is, a vector quantizer operates on vectors (blocks of samples) instead on scalars. integers real numbers 4 3 2 1 0 4 3 2 1 0 unquantize d samples quantized samples (a) codevectors block into vectors 4 3 2 1 0 codevector indicies 000 001 010 011 100 unquantized samples codebook with 2-D codevectors (b) Figure 1 Illustration of (a) scalar and (b) vector quantization Quantizers play an important role in the theory and practice of modern-day signal processing. The asymptotic optimal quantization problem, even for the simplest case uniform scalar quantization, is very actual nowadays, [1,2]. They do consider the problem of finding the optimal maximum amplitude, so-called, support region for scalar quantizers by minimization of the total distortion D, which is a combination of granular (Dg) and overload (Do) distortion, D D g Do . Extensive results have been developed on scalar quantization but more on vector quantization. The simplest vector quantization is two-dimensional vector quantization. The analisys of vector quantizer for arbitrary distribution of the source signal was given in paper [3]. The authors derived the expression for the optimum granular distortion and optimum number of output points. However, they didn't prove the optimality of the proposed solutions. Also, they didn't define the partition of the multidimensional space into subregions. In paper [4], the expressions for the optimum number of output points are derived, however the proposed partitioning of the multidimensional space for memoryless Laplacian source doesn't consider the geometry of the multidimensional source. In paper [5], vector quantizers of Laplacian and Gaussian sources were analyzed. The proposed solution for the quantization of memoryless Laplacian source, unlike in [5], takes into consideration the geometry of the source, however, the proposed vector quantizer design procedure is too complicated and unpractical. In this paper we will give a systematic analysis of piecewise uniform vector quantizer (PUQ) of Laplacian memoryless source. We will give a general and simple way to design a piecewise uniform vector quantizer. We will derive the optimum number of output points and the optimality of the proposed solutions will be proved. The goal of this paper is to solve a quantization problem in a case of PUQ and to find corresponding support region. It is done by analytical optimization of the granular distortion and numerical optimization of the total distortion. If the distortion is measured by squared error, D becomes the mean squared error (MSE). Distortion mean-squared error (MSE i.e. quantization noise) is used as the criterion for optimization. The MSE of a two-dimensional vector source x ( x1 , x2 ) , where xi are zero-mean statistically independent Laplacian random variables of variance , is commonly used for the transform coefficients of speech or imagery. The first approximation to the long-time-averaged probability density function (pdf) of amplitudes is provided by 2 Laplacian model [7,p32]. Waveforms are sometimes represented in terms of adjacent-sample differences. The pdf of the difference signal for an image waveform follows the Laplacian function [7,p33]. Laplace source is a model for speech [8,p384]. Consider two independent identically distributed Laplace random variables (x1,x2) with the zero mean and unity variance. To simplify the vector quantizer, the Helmert transformation is applied on the source vector giving contours with constant probability densities. The transformation is defined u 1 2 x 1 as: r 1 2 x 1 x2 , x 2 . In this paper, quantizers are designed and analysed under additional constraint – each scalar quantizer is a uniform one. PUQ consists of L optimal uniform vector quantizers. More precisely, our quantizer divides the input plane into L partitions and every partition is further subdivided into Li ( 1 i L ) subpartitions. Every concentric subpartition can be subdivided in four equivalent regions, i.e. J-th subpartition in signal plane is allowed to have p ij ( 1 i L, 1 j Li ) cells. We perform two-steps optimization: 1) distortion optimization ( Di ) in every partition under the constraint Li 4 p ij N i and 2) optimization of the total granular j 1 distortion Dg C , which is the codebook. The codebook has a positive integer number of code vectors (denoted by y i ) that the finite subset defines the codebook size, denoted by N. The bit rate R associated with the VQ depends on N and the vector dimension k. Since the bit rate is the number of bits per sample, (1) R (log 2 N ) / k In contravention to basic scalar quantization which is fixed-rate, for VQ is natural to have fractional bit rates such as ½, ¾, etc. The decoding process is very simple and requires only a table (codebook) lookup, but the encoding procedure is complex and involves finding a best matching code vector, using a distortion measure as a criterion. The most common distortion measure is mean squared error, given by: k d ( x, y ) ( x y ) t ( x y ) ( x[l ] y[l ]) 2 , (2) l 1 where x[l ] and y[l ] are the elements of the vector x and y , respectively. ENCODER E x search I output index x DECODER reconstructed D vector lookup x=y i i 000 i encoder codebook 001 010 000 decoder codebook 001 indices 010 L D i 1 i which achieves the optimal number of L points N i on each partition under the constraint N i 1 i N. In this work we will design a piecewise uniform vector quantizer for optimal compression function. We will perform analytical optimisation of the granular distortion and numerical optimization of the total distortion using rectangular cells. The switching quantization aims are to improve the quality of the signal-to-noise ratio in the wide range of the signal average power (i.e. variance) or to decrease the sample rate. The switching quantization is adaptive quantization for memoryless sources and it is aplicable only if adaptation is performed on the basis of the signal average power, what was just done in this paper. As an input source, we will consider memoryless Laplacian source. Basic notes on VQ The conceptual notion of VQ is illustrated in Figure 1 (b). These blocks of samples are represented by code vectors and stored in a codebook- a process called encoding. A block diagram of the encoder is shown in Figure 2. The encoder k performs a mapping from k-dimensional space R to the index set I , and the decoder D maps the index set I into 111 codevectors y 111 Figure 2 Block diagram of a VQ encoder and decoder. It is convenient to view the operation of a vector quantizer geometrically, using our intuition for the case of two or three-dimensional space. Thus, a 2-dimensional quantizer assigns any input point in the plane to one of a particular set of N points or locations in the plane. The plane is divided into N partition cells, as shown in the Fig.3.(a), and the dots represent code vectors, one in each cell. A unique partitioning of the space is defined by the encoding procedure, and optimized for a given input source, to give the best performance. Now consider quantizing our fictional input source with scalar quantization at an equivalent bit rate. The cells implied by using a scalar quantizer for the input source are shown in the Fig.3(b). Notice that each cell is constrained to be rectangular, and some cells are forced to be placed in regions where the input source may not be significantly populated. These observations lead to two immediately recognizable advantages of VQ over scalar quantization. First, VQ provides greater freedom to control the shapes of the cells to achieve more efficient tilings of the space. This property is often called cell shape gain. Second, VQ allows a greater number of cells to be concentrated in the regions where the source has the greatest density, which reduces the average u distortion. m ri ri+1 ri mi,j ri i,j(i) i, j uijk , uˆ i , j , k ui, j,k+1 r 2mi,j ri,j (a) ri,j+1 (b) Figure 3 Illustration of the partition cell associated with VQ and scalar quantization: (a) partition cells for a 2D VQ; (b) partition cells corresponding to scalar quantization. Figure 4 Two-dimensional space partitioning. The initial expression for granular distortion is: 2 2 r mi, j u uˆ i, j,k L Li pi , j ri , j 1 ui , j , k 1 D g 4 i 1 j 1 k 1 ri , j ui , j , k Piecewise uniform vector quantizer design 1 (6) 2r e drdu Joint pdf function of two independent, identically distributed Laplace random variables (x1 , x2 ) with zero mean is given with the following expression: 2 x1 x 2 1 f1,2 x1 , x 2 e (3) 2 Rectangular cell dimensions are: After applying the Helmert transformation [9,10]: i ri 1 ri , i 2 1 r 2 x 1 x2 , u 1 2 x 1 x2 we get probability density function: 2r 1 f (r , u ) 2 2 (4) The otput point coordinates are given by the equations: mi , j ri , j 1 ri , j 2 uˆ i , j ,k and u i , j ,k u i , j ,k 1 2 ri , j ri , j 1 i and ij pi , j Li ri , j ri j i , i 0, , L , j 0, , Li (7) (8) (9) rmax . To determine the boundary values of every concentric domain, denoted as ri , The range of the quantizer is e (5) In two-dimensional ru system the pdf function given by equation (5) represents square line. The square surface (0, rmax ) representing dynamic range of a two dimensional quantizer, can be partitioned into L concentric domains as shown in Fig. 1. In the case of nonuniform vector quantization, these concentric domains are of unequal width. The number of output points in each domain is denoted by N i , where N i 1 N i represents the total number of output points. L Every concentric domain can be further partitioned into Li concentric subdomains of equal width. Every subdomain is divided into four regions each containing p i , j rectangular cells. An output point is placed in the centre of each cell. Coordinates of the kth output point in jth subregion of the ith region in ru coordinate system are m i , j , uˆ i , j , k . 2 2 for the case of nonuniform vector quantization we will perform segmentation and linearization of the optimal compress function, given by the following expresion: h(r ) rmax e 1 r 2 1 1 rmax 2 e (10) 1 The method for linearization of compression function, named first derivate segmentation, was selected based on the analysis performed in [11]. The principle used in this method is to do a uniform segmentation of first derivate of compression function, and find corresponding ri points by substituting uniformly distributed derivate function. Total numer of output points is: h values in inverse first L N Ni i 1 (11) where N i is the number of output points in the ith domain. We can also write: Li Ni 4 pi , j j 1 Function L D g D g i i 1 Li pi , j ri , j 1 ui , j , k 1 D g i 4 j 1k 1 ri , j ui , j , k 1 r m i, j 2 u uˆi, j,k 2 (14) 2r e drdu 2 2 After integration over u and reordering equation (14) becomes: 2r Li ri , j 1 2 2 D g i r mi, j ri, j 1 ri , j e dr 2 j 1 ri , j (15) ri , j 1 ri, j 1 ri, j 3 12 p i2, j ri , j 2r e dr 2 2 ri, j 1 ri, j 2mi, j . From equation (7) it follows that When we substitute this in equation (15) we get: 2r Li ri , j 1 1 2 D g i r mi, j 4mi , j e dr 2 j 1 ri , j ri , j 1 ri , j (13) mi2, j 3 pi2, j 1 4mi , j e dr 2 of . Li 4mi, j j 1 Li 4mi, j j 1 1 2 1 2 e ri , j 1 mi2, j r m 2 dr dr i, j 3 p 2 i, j ri , j ri , j 2mi , j j 1 (20) After differentiating J with respect to pi , j , and equalizing the derivate with zero we get: 4mi3, j J 0 P0 mi, j 0 (21) pi, j 3 pi3, j From the preceding equation we can write the following: 4mi3, j 4 f 0 mi, j i 3 (22) pi , j P0 mi, j mi, j 3 3 2 2mi, j P mi, j 2mi, j i 12 3 pi2, j j 1 Li where P pi, j j 1 we can eliminate mi, j denotes the probability: 3 3 from equation (22) in equation (12): 4 f 0 mi, j i N i 3 4 (23) by substituting: L 4 i mi, j 3 4 f 0 mi, j i N i j 1 (24) in equation (22): pi , j 3 mi2, j i i 12 3 pi2, j (19) J D g i pi , j mi, j 3 2 m i , j ri , j 1 e Li D g i (18) We'll start from the following equation: If we substitute Li exp 2r / is constant over i . In that case we can substitute exp 2r / with exp 2mi, j / . Equation (16) can be now written as: mi , j e 2 2mi , j minimum granular distortion defined by the equation (17). Because we are designing an optimal quantizer for one value of variance 0 , in calculating pi , j we will use 0 instead 3 2r 2 2 By using the Langrangian multipliers we can obtain the optimum number of cells in one region pi , j , which yields the (16) We will now assume that f mi, j Dg (i) is: where e 2 f mi, j is defined as: P mi, j i f mi, j i (12) Equation (12) can be written as: 2 N i mi, j 3 g 0 mi, j 4 Li mi, k 3 g 0 mi, k (25) k 1 wher g 0 mi, j denotes the function: (17) g 0 mi, j 1 2mi , j 0 (26) e 2 0 If we multily numerator and denominator with i , we can approximate the sum by the integral: N mi, j 3 g 0 mi, j i pi , j i 4 ri 1 r 3 g 0 r dr L (27) J D g N i N i i 1 (34) After differentiating (33) with respect to Ni, and for 0 we get: ri pi, j from equation (27) in equation (17) we By substituting get: D g i 2i Li mi, j g 0 (mi, j )i 3L2i j 1 (28) Li 64 L2i g (mi, j ) I (i ) 2 mi, j 2 2 0 2/3 i 3N i i g ( m ) j 1 0 i, j After approximating the sum by the integral, we can rewrite (28) as: 64 L2i 2 (29) D g i I i I i 2 I (i ) 2 2 2 0 3Li 3N i The functions I 0 i , I (i ) and I i are defined as: ri 1 I 0 i r 3 g 0 r dr ri I i ri 1 r g ri I i g (r ) 0 (r ) 2/3 dr (30) (31) (32) ri Substituting the expression for Li from equation (31) in equation (29), Dg(i) becomes: Dg i 14 k 1 I 0 (i ) I i I i 14 3 0 (37) 0 Now, we can callculate the optimum granular distortion of uniform piecewise vector quantizer as: L D g i I (i ) 0 I (i ) i 1 0 I (i ) 8 I (i ) I 0 (i ) 0 I (i ) 0 I (i ) (33) Ni I 0 (i ) I 0 (i ) The optimum number of output points in the ith subdomain is obtained using Lagrangian multipliers: 3/ 4 8 3N I 0 (i) 3 I 0 (i)1/ 4 L i 1 1/ 4 I (i) I (i) 0 I 0 (i) (38) I (i) We can calculate the overload distortion as: p L , LL u L , j D0 4 r m L, L L 2 u uˆ L, j 2 j 1 rmax u L , j where I 0 (i) is defined as: ri 1 r g 0 r dr 8 3N L domain: I 0 i I 0 k 3 I 0 k L i 1 ri After differentiating Dg from equation (29) with respect to Li, and for 0 , we obtain the optimum number subdomains in ith 64 I 0 i 3 Dg r g r dr Liopt 4 I (i ) I (i ) 0 I (i ) 0 I (i ) I (i ) I 0 (i ) 0 ri 1 I 0 i N i2 (35) Using the condition (11) we can eliminate from the equation (35): 14 I 0 i 3 I 0 i (36) Ni N L 1 4 I 0 k 3 I 0 k k 1 Finally, after substituting the expression for optimum number of output points from equation (36) into equation (33) we can write: D g (i ) 16 I 0 i I 0 i I 0 i 3 Ni 1 2 2 (39) 2r e drdu After some calculation, we get: 2r mL, LL max 2 Do e 2 rmax rmax 2 2 4 mL, LL 2 (40) 3 2mL, LL 2mL2, L L From equations (31) and (33), we can calculate the total distortion for one dimension as: 2mL2, L L 2 3 p L, L L D 1 ( D g Do ) 2 (41) 30 Numerical results 25 The results are shown in Figure 5 for two values of 0 (two different quantizers): 0dB and -10dB, and for bitrate of R=7.5. For comparison, dash-dotted lines show SQNR for scalar quantization for R=8, for a compression function given with: r rmax 1 e (42) f (r ) rmax 1 e where is a compression factor, with a critical value for c 2 rmax 3 0 SQNR[dB] 15 SQNR is a signal-to-quantization noise ratio, given with: 2 (44) SQNR[dB] 10 log Duk We can see from this figure that there is a 0.5 bits gain in the case of vector quantization. In Figure 6 we have changed bitrate to R=4. In Table 1., as an illustration of previous analysis, the number of rectangular cells in each of four regions in a particular subdomain, denoted as pi , j , is given. The optimal number of subdomains in every domain ( Liopt ) is calculated for L=4 concentric domains and bitrate R=4, giving the value 2. 50 vector (variance=-10dB, 0dB), R=7.5 10 5 scalar (v=5, 20) 0 -5 -10 -15 0: (43) vector (variance=-10dB, 0dB) 20 R=4 -20 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 variance Figure 6 SQNR for scalar and vector (bitrate=4) quantization with two optimal quantizers designed for different values of 0 pi , j 1 2 L=4 1 1 3 2 6 7 4 13 13 3 9 11 Table 1 Number of rectangular cells for R=4 For nonstationary inputs a logical scheme is switched quantization; this consists in providing a bank of B fixed quantizers, and switching among them as appropriate, in response to changing input statistics. This scheme is used for two designed quantizers, as shown in the Figure 7. 40 Q1( · ) SQNR[dB] 30 Q2( · ) · · · x(n) 20 10 Q B (· ) scalar (v=5,20) R=8 CONDITIONAL ESTIMATOR 0 -10 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 variance Figure 5 SQNR for scalar (bitrate=8) and vector (bitrate=7.5) quantization with two optimal quantizers designed for different values of 0 Figure 7 Block diagram of switched quantization Conclusion The optimization of two-dimensional Laplace source piecewise nonuniform vector quantization is carried. Simple expression for granular distortion, number of subdomains and number of output points in closed form is obtained. The results obtained by using two vector quantizers optimized for two different values of (variance) demonstrate the significant performance gain over the uniform scalar quantization, giving a 0.5 bits/sample gain. Memoryless Laplacian source is used, considering the possible application of this quantizer. The transform coefficients of DCT (discrete cosine transform) encoding of speech or imagery are often modeled as Laplacian, except for the DC coefficient of imagery. By using switched quantization, with two quantizers in this case, necessary rate is decreased by 0.5 bits per sample, with compliance of the appropriate standard. With a larger set of quantizers we could increase this sample rate even more, thus giving a better compression quality with higher SQNR. References [1] D. Hui, D. L. Neuhoff, "Asymptotic Analysis of Optimal Fixed-Rate Uniform Scalar Quantization," IEEE Trans., 2001,IT-47(3), pp. 957-977. [2] S. Na, D. L. Neuhoff, "On the Support of MSEOptimal, Fixed-Rate Scalar Quantizers" IEEE Trans., 2001, Inform.Theory (IT)-47(6), pp. 2972-2982. [3] F. Kuhlmann, J. A. Bucklew, "Piecewise Uniform Vector Quantizers", IEEE Trans., 1988,IT-34(5), pp. 1259-1263. [4] P. F. Swaszek, "Unrestricted Multistage Vector Quantizers", IEEE Trans., 1992,IT-38(3), pp.1169-1174. [5] D.G.Jeong, J. Gibson" Uniform and Piecewise Uniform Lattice Vector Quantization for Memoryless Gaussian and Laplacian Sources", IEEE Trans., 1993,IT-39(3), pp. 786-804. [6] R.M.Gray, D.L.Neuhoff “ Quantization “IEEE Trans., 1998,IT-44(6), pp. 2325-2384. [7] N.S.Jayant and P.Noll, "DIGITAL CODING OF WAVEFORMS Principles and Applications to Speech and Video", Prentice-Hall, New Jersey (1984). [8] A. Gersho and R. M. Gray, "Vector Quantization and signal Compression", Kluwer Academ.Pub(1992). [9] Zoran H. Peric, Jelena D. Jovkovic, Zoran J. Nikolic, TwoDimensional Laplas Source Quantization, IEEE conference TELSIKS 2001, Nis pp 33-37. [10] Peter F. Swaszek, A vector Quantizer for the Laplas Source, IEEE Transactions on Information Theory, Vol. 37, No.5, Sept. 1991 [11] Ivana Tosic, Divna Djordjevic, Analysis of varios linearization methods for twodimensional Laplaces source TELFOR 2002 pp. 683-686.