Modified Golomb Coding Algorithm for Asymmetric Two-Sided Geometric Distribution Data
Total Page:16
File Type:pdf, Size:1020Kb
20th European Signal Processing Conference (EUSIPCO 2012) Bucharest, Romania, August 27 - 31, 2012 MODIFIED GOLOMB CODING ALGORITHM FOR ASYMMETRIC TWO-SIDED GEOMETRIC DISTRIBUTION DATA Jian-Jiun Ding, Wei-Yi Wei, and Guan-Chen Pan Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan [email protected], [email protected], [email protected] ABSTRACT 11pp12 where A and p1 p2. (2) 1 pp Golomb coding is useful for encoding geometrically 12 distributed data and plays an important role in advanced In (1) and (2), p1 p2 means that the probability that the compression techniques, such as JPEG-LS and H.264. In data has a positive value is unequal to the probability that this paper, a new Golomb coding method for asymmetric the data has a negative value. Moreover, the ratio of two-sided geometrically distributed data is proposed. An PS[n]/PS[n+1] is also unequal to PS[n]/PS[n1]. In our asymmetrical model means that the value of x can be daily life, there are many conditions that the data has an positive or negative, but the ratio P(x = -n)/P(x = -n-1) is ATSGD. For example, the probability that the population unequal to P(x = n)/P(x = n +1). The asymmetric model is of a country increases is higher than the probability that the more suitable for modeling the practical case because many population decreases. The probability that the weight of a data have higher probability to be positive (or negative) child increases is higher than the probability that the weight than to be negative (or positive) in nature. Two simulation decreases. examples are given: One is to encode the object boundaries In image compression, there are also many cases for binary image compression and the other one is to where the data has an ATSGD. When encoding the encode the DC differences in JPEG. Both simulation boundaries of objects, the curve is more possible to be results show that the proposed asymmetric two-sided convex than to be concave. Since the convex case has Golomb coding algorithm outperforms other methods and higher probability, it is proper to model the height of each has higher ability for data compression. segment of the curve by an ATSGD (illustrated in Section 4.1). Moreover, in the DC differential coding process of Index Terms— Image compression, data compression, JPEG, if the previous block has lower DC value, then the Huffman code, Golomb code, JPEG difference between the DC value of the current block and that of the previous block has higher probability to be 1. INTRODUCTION positive (illustrated in Section 4.2). For the examples described as the above, using the proposed modified The Golomb code [1][2] is suitable for encoding the data Golomb code will achieve higher compression ratio than whose probability has a geometrical distribution. It has using the Huffman code and the original Golomb code. been adopted by some advanced compression algorithms, (Note that, although the Huffman code is optimal in theory, such as JPEG-LS and H.264 [3]. Unlike the Huffman code, the coding table is required.) the Golomb code does not require a coding table. Therefore, This paper is organized as follows. The geometric if one uses the Golomb code instead of the Huffman code distribution and Golomb coding are reviewed in Section 2. to encode a geometrically distributed data, such as the AC In Section 3, the proposed modified Golomb code for coefficients and the zero run length in JPEG, higher encoding an asymmetric two-sided geometrically compression ratio can be achieved. distributed data is presented. In Section 4, two examples In this paper, the Golomb code is modified to encode that use the proposed modified Golomb code to encode the the data that has an asymmetric two-sided geometric object boundaries for binary image compression and distribution (ATSGD). That is, the value of a data can be encode the DC differences in the JPEG process are shown. positive or negative and the probability distribution of the In Section 5, we make a conclusion. data has the form of s 2. GEOMETRIC DISTRIBUTION AND Ap1 ,for s 0 Ps . (1) GOLOMB CODING S s Ap2 ,for s 0 © EURASIP, 2012 - ISSN 2076-1465 1548 0.30 PS[s] 0.20 0.25 p1 p2 0.15 0.20 ) ) S S ( ( 0.15 0.10 Prob Prob 0.10 |s| s 0.05 Ap2 Ap1 0.05 0.00 0.00 0 5 10 15 20 -10 -5 0 5 10 s Symbol S Symbol S -2 -1 0 12 Figure 2 – The proposed modified Golomb code is suitable for (a) One-sided geometric (b) Two-sided geometric encoding the data whose probability has an asymmetric two-sided distribution distribution geometric distribution (asymmetric TSGD). Figure 1 – One-sided and the two-sided geometric distributions. 2.1. Geometric Distribution 3. PROPOSED MODIFIED GOLOMB CODES FOR ASYMMETRIC TWO-SIDED GEOMETRICALLY The geometrical distribution can be classified into two DISTRIBUTED DATA types. One is the one-sided geometric distribution (OSGD), and the other one is the two-sided geometric distribution In image compression, sometimes the absolute value of a (TSGD). The illustration of the OSGD and the TSGD are data has a geometric distribution but the probability that the shown in Fig. 1. The data with the OSGD is modeled as data has a positive value is unequal to the probability of the follows: s negative value case. In this case, one can use (1) to model PsS [] (1 pp ) where s 0 . (3) the probability distribution of the data, which is also and p is the common ratio (p (0, 1)). By contrast, the data depicted in Fig. 2. with the TSGD can be modeled by (1). In (1), if p1 = p2, To encode the data S whose probability has the form then the data is said to have a symmetric TSGD. Otherwise, as in Fig. 2, a mapping function can be utilized to map S it has an asymmetric TSGD (ATSGD), see Fig. 2. into a new data S such that the value of S is non-negative and nearly has a geometric probability distribution 2.2. Golomb Coding First, assume that the probability parameters p1 and p2 in (1) have the following relationship Golomb coding [3][4][5][6][7][8] is a lossless data k p p (5) compression method and has been adopted by JPEG-LS 21 and H.264 [3]. The Golomb code is fully equivalent to the where k is called the asymmetric parameter. Then, from (1), Huffman code if the probability of the data has a OSGD. one can verify that The Golomb code has a tunable parameter m, which is PsSS P t (6) known as Golomb parameter. In the OSGD case, the where s > 0, t = 1, 2, …., s/k 1, optimal Golomb parameter m can be estimated by: Moreover, log 1 p PtPs (7) mp (4) SS log p where t 0, s = 0, 1, …, k|t|, where p is the common ratio defined as in (3) and and means rounding toward zero (i.e., the flooring means rounding toward infinity (i.e., the ceiling operation). operation). Therefore, from (6) and (7), one can apply the If the data is not geometrically distributed, one can following mapping function to generate S from S: approximate its probability by a geometric distribution s function and use the Golomb code to encode it. Although ss 1 ,for 0 in this condition the optimal coding results may not achieve, s k (8) since the Golomb code does not require a coding table, sks ,for s 0 which is needed by the Huffman, using Golomb code where k is defined as in (5), i.e., kpp log / log . Eq. (8) always achieve a lower bit rate than using the Huffman 21 code in practice. is a one-to-one mapping operation. It comes from sorting In the symmetric TSGD case, one can use an extra bit the magnitude of PS(s) according to (6) and (7) and one can to represent the sign and then apply the method the same as verify that the probability that Ss 1 is always no less than that of the OSGD case to encode the data. In the ATSGD the probability that Ss if s1 < s2. case, we suggest that it is proper to apply the proposed 2 method in the next subsection to encode the data. Moreover, if n = s + s/k 1 where s > 0, then 1549 s sk/1 n s sk /, (9) (p , q ) y1 (outward) k k 0 0 s n and sn(1), X x 1 k 1 k 1 (p5, q5) 1 x6 kk (p1, q1) (1)nn ‐y1 kk11s Ap P n Ap Ap . (10) 111S x5 x2 Similarly, if n = |s| + k|s| where s 0, then ‐y2 (p , q ) s ks1 n s ks, (11) 4 4 y2 x4 (outward) snk/( 1) and sn(1)/(1) k , x3 (p3, q3) (p2, q2) kn1 nk (1)nn (a) (b) Apkk11 Ap P n Ap||s Ap kk 11 Ap . (12) 12S 221 Figure 3 – (a) Most parts of an object are convex. (b) Using a 2nd Therefore, from (10) and (12), order polynomial to approximate a curve. nn1 Pn() S pp33, (13) PS (0) Note that, as the original Golomb code, the proposed k modified Golomb code for the ATSGD case also requires k 1 where pp31 . (14) no coding table. One only has to record the value of m and That is, although S is not geometrically distributed, one k.