SIGNAL
PROCESSING ELSEVIER
Signal Processing
63 (1997) 35-43
A unified mathematical form of the Walsh-Hadamard for lossless image data compression
transform
.Ho-You1 Jung”, R&my ProsF,*, Tae-Young Choib a CWIIW de Recherche et d’Applications en Traitement de I ‘Image et du Signal (CREATIS), CNRS Research Unit (UMR 5515) and @liared INSERM, INSA 502. 20 Avenue Albert Einstein, 69621 Villeurbanne Cedex, France b Department of Electronics, Ajou Univer.Tity, Wonchun-dong, Suwon, 442-380, South Korea Received
IO October
to
1996; received in revised form 28 July 1997
Abstract A unified mathematical form of the integer Walsh-Hadamard transform (WHT) has been introduced for lossless image data compression, which is called the unified lossless WHT (ULWHT). The ULWHT extends the previous schemes that have been defined for only 2 x 2 WHT. This allows a larger size WHT to be applied to the lossless pyramid structured coding. We show that, due to its ability to process large block sizes, the ULWHT always reduces the entropy when each transform coefficient is encoded separately. However, in the case of encoding all transform coefficients at the same time, the total entropy will first decrease and then increase for a sufficiently large block size. In the latter case, computer simulation results show that the ULWHT has the lowest entropy of all the test images when using the 23 x 23 block size. In the application of the ULWHT to lossless pyramid structured coding, the use of the smallest size ULWHT (i.e., S-Transform) performs better than that of the other sizes. c; 1997 Elsevier Science B.V. Zusammenfassung Eine verallgemeinerte mathematische Form der Walsh-Hardamard transformation (WHT) wird zur verlustlosen Bildkompression vorgestellt, die verallgemeinerte verlustlose WHT (unified lossless WHT: ULWHT) genannt wird. Die ULWHT erweitert die bisherigen Methoden, die nur fiir die 2 x 2 WHT definiert sind. Das erlaubt eine WHT einer anderen Gr613e zur verlustlos pyramidal-strukturierten Kompression. Wir zeigen, daR die ULWHT bei gr6Rerem Block die Enthropie reduziert, falls die Transformationskoeffizienten separat kodiert werden. Jedoch fiir den Fall, daR die Transformationskoeffizienten gleichzeitig kodiert werden, sinkt die Gesamtenthropie zuerst und steigt anschliei3end fiir ausreichend grol3e Bliicke. Im letzteren Fall zeigen die Computersimulationen, darj die ULWHT die geringste Enthropie fiir alle Testbilder hat, falls die Blockgr%e 23 x 23 betrggt. Bei Anwendung der ULWHT zur verlustlos pyramidalstrukturierten Kompression liefert die 2 x 2 ULWHT (d.h. S-Transformation) bessere Ergebnisse als jede andere GrGRe. c’ 1997 Elsevier Science B.V.
Une dCfinition unifike de la transformation entikre de Walsh-Hadamard (integer WHT) est dkveloppke pour la compression sans perte. Elle est appelke ULWHT (unified lossless Walsh-Hadamard Transform). L’ULWHT gknbralise les mCthodes dCfinies pour des WHT de dimensions, 2 x 2. Cette nouvelle transformation permet l’ultilisation de blocs de
* Corresponding
author.
Tel.: (33) 4 72 43 80 72; fax: (33) 4 72 43 85 26; e-mail: remy.prost@,creatis.insa-lyon.fr
0165- 1684/97/$17.00 (: 1997 Elsevier Science B.V. All rights PI1 SOl65-1684(97)00138-2
reserved.
H.-Y. Jung et al. / Signal Processing 63 (1997) 35-43
36
dimensions superieures a 2 x 2 dans une approche pyramidale en compression sans perte. Nous montrons que, grace a sa capacite a traiter de grands blocs, I’ULWHT rtduit toujours l’entropie lorsque chaque coefficient transforme est code separement. Lorsque les coefficients sont codes simultantment, l’etude de l’entropie en fonction de la taille des blocs montre que celle-ci commence par decroitre puis finit par s’accroitre pour des grands blocs. Dans ce dernier cas, les simulations, a l’aide d’un ensemble d’images de reference, montrent que l’entropie est minimisee pour des blocs de dimensions 23 x 23. Lorsque I’ULWHT est utilisee en compression sans perte dans une structure pyramidale, la plus petite dimension (2 x 2, dimension de la Transformation S) est celle qui a les melleures performances. 0 1997 Elsevier Science B.V. Keywords:
Lossless image compression;
Pyramid structured coding; Walsh-Hadamard
transform (WHT); Rounding
operations
1. Introduction
The one-dimensional (1-D) integer WalshHadamard transform (WHT) and its inverse are defined as [l] YNxl
--w
NxN
X Nxl =- lW N
x
NXN
Nxl,
(1)
X Nxl,
(2)
where N is a power of two (N = 2”). Note that WN x N is an N x N size integer Walsh-Hadamard matrix that is generated by using the recursive relationship, starting from the smallest 2 x 2 size matrix W2 x 2 as follows: W NxN
-
wN,2
X N/2
with W2x2 =
@
w2
X 29
(3)
where @ denotes a tensor product. Integer WHT has been often used for lossless (reversible) image compression [6]. In particular, the smallest size 2 x 2 WHT has been effectively applied to lossless pyramid structured coding [l, 7,8,10,12], which is known as the Sequential (S-) transform [4]. In recent works [9, 131, a more efficient compression scheme was reported which uses the S-transform-based lossless wavelet transform coding. All these schemes use a computational algorithm based on the properties that both transformed data are both odd or both even values when using the smallest 2 x 2 size integer WHT. However, it has been difficult to represent the computational
process (particularly for the case of a general size WHT), in a generalized mathematical form. In this paper, a unified mathematical form is introduced for the computation of a general size lossless WHT. We call it a unified lossless WHT (ULWHT). This permits applying a larger size WHT to the lossless pyramid structured coding. The proposed form employs a pair of rounding operations. That is, both floor and ceiling operations are used for the forward and inverse transformations, respectively. This ULWHT is more extended than the previous schemes [9, 131 that have been defined only for 2 x 2 WHT by using the same rounding operation (floor) for both forward and inverse. The use of the pair of rounding operations was first introduced in our previous work [2]. In this paper some more specific properties are addressed and used for deriving the proposed method. A detailed performance analysis of the ULWHT is given which takes into consideration of stochastic characteristics. To evaluate the performances of the ULWHT in terms of the total lossless first-order entropy, simulations are carried out by varying the size of the transform. Lossless pyramid structured coding schemes based on various sizes of ULWHT are also compared with other lossless pyramid structured coding schemes such as hierarchy embedded differential image (HEDI) [3] and reduced difference pyramid (RDP) [ 111.
2. Properties of rounding operations Floor and ceiling operations are denoted by L. J and r .I, which take the nearest inferior integer
H.-Y Jung et al. / Signal Processing 63 (1997) 35--43
37
value and the nearest superior one, respectively. Their basic properties are summarized. I- -xl
= - LXJ>
t - EJ = -
(8)
r4
[m+~l=m+rxl.
Lm+xJ=m+LaJ,
rm-Xl=n~-LXj,
Lm-cxJ=m-[al,
(9)
(4) where
where, m is an integer (171E Z) and #c!is a real value (Z E R). For a real number (XE R) and four integers (m, p, q, r EZ), two specific properties can be obtained as follows:
is the inverse
IT1
+ LF]
=m
ifp+q=r,
(5)
(‘;2
p?]
+ [Fl
=m
ifp+q=r.
(6)
The reversibility of the transform can be easily proved. The forward transform of Eq. (8) can be rewritten as follows:
Eq. (5) can be proved p-1
by using Eq. (4).
zo=
+ L’-‘]
matrix
of
“z j.
1 1 x0 + Xl ___ *
)
zl=xo-xl.
By substituting the above equations in Eq. (9) and using the properties of rounding operations, we prove that the transform is able to perfectly recover the original integer data: Similarly, Eq. (6) can be also proved. If CIis replaced with another integer n (n E Z) and p = q = 1 in Eqs. (5) and (6), more specific properties are obtained:
(7) Multiplying by a scaling matrix, the transform becomes the smallest integer WHT with the exception of roundoff error.
3. Unified lossless WHT (ULWHT) For any two given integers x0 and x1, the smallest size ULWHT and its inverse transform are defined as
Note that the scaling factor is not necessary since it enlarges the dynamic range. By maintaining this form of 2 x 2 ULWHT matrix in Eq. (lo), the general size integer WHT matrix
H.-Y Jung et al. 1 Signal Processing
38
WN xN can be expressed as multiplication of log, N matrices Wj,,, (j = 1, . . . , log, N), W NxN- -3,
NxN
Wb,
N W&z N- 1 . . . W’
NXN
NxN
NxN>
(11)
ANxN denotes an N x N scaling factor generated by using the recursion
where
Then Wj, x N can be obtained as follows: I2 wi,,,
x 20
w&,2
x N/2
forj
<
log2
N,
x N/2
forj
=
lo&
N,
= wi
x 2@IN/2
“2J
For a detailed derivation, the 23 x 23 integer Walsh-Hadamard matrix is considered as an example in Appendix A. Similarly, other size integer Walsh-Hadamard matrices can be derived. Omitting the scaling factor &xN and applying a rounding operation to each decomposed transform stage, the general size 1-D ULWHT and its inverse can immediately be defined as Z Nx 1
=
~Wjyog:~pq&y_
1~x1< 1,
(16)
where rx is the correlation coefficient of x’ and x”. The transformed data, z. and zl, can be also viewed as random variables, z’ and z”, which are obtained from x’ and x” using the following liner transformations: z’=fxl
+ix” ) z” = x’ - x”,
Note that the rounding operations are disregarded. The joint probability density function of z’ and z”, f(z’, z”), is obtained as follows:2
( Jv
f (z’, z”) = N 0,O;
cx,
dm
0,;
0). (17)
...
]_j])
(12)
... rw%;-lm’ ‘2N.111’..11> rw pW2N”m
The z’ and z” are independent and their probability density functions, f(z’) and f(z”), are both zero mean and Gaussian as follows:
(13)
whereWimln, is the inverse matrix of Wk,,. Note that the order of the inverse transform must be the reverse of that of the forward transform. In a similar manner, the 2-D ULWHT is defined as follows:
.*. 1 Jwgg:/*I) X NxN = rW;;Nrr
First, we consider the stochastic characteristics of the smallest ULWHT of Eq. (8) since the computations of the general size ULWHT are performed as a sequence of the smallest transformation. For the sake of simplicity,’ we assume that the two input data, x0 and x1, are real random variables, x’ and x”, which have a joint normal probability density function f(x’,x”), with zero mean, g,, = qx,,= 0, and equal variance, C$ = o$ = af, as follows:
...
LW~~NXN~IJ
X Nxl = rw;;.r
4. Performance analysis
.0x’+“) = N(O,O;a,,a,;r,),
where IN x Nis an identity matrix of size N x N and
w:,, = (”
63 (1997) 35-43
(14)
(18) The transform variances are very important factors for estimating the compression efficiency, since the entropy of a normal random variable x, H(x), is given by [S] H(x) = In (0~6).
(19)
“‘rW)v”“:,“-’
rZNxNW~;~T where the superscript inverse.
11 “’
jwk:Nll
- T denotes
>
(15)
transposed
1 Clearly, the input data are integers. However, the proposed approach is valid because the discrete probability density function is close to the continuous Gaussian function. ‘A similar derivation can be found in [S], pp. 144.
H.-Y Juttg et al. /Signal Processing 63 (1997) 35-43
Assume that each transform coefficient is entropy encoded separately. This case can be regarded as a codebook assigned to each transformed data. The resulting entropy is / 4 (H(d) + H(z”)) = f In(,/ 1 - r; 0: 27ce). According to Eqs. (16) and (19), the entropy input data is f (H(x’) + H(x”)) = 4 ln(az 27ce).
(20) of the
(22)
As a result, the smallest ULWHT always reduces the entropy. Since a larger ULWHT is calculated as a sequence of the smallest transformations, entropy is further reduced with increasing block size. This new result is very encouraging. However, it is difficult to assign a codebook to each transform coefficient in practical implementation because of the complexity. Therefore, we consider the sub-optimal coding technique of using one and the same codebook for all transform coefficients. In this case, the transformed data can be regarded as a new random variable z chosen randomly from the z’ and z”. The total probability density function of the zI h(z), equals ffz)
=
.LW + .L,44 2
.
of the input data is lower than about 3 when using the same codebook. We will now show that the correlation coefficient is a decreasing function of the transform stage. Let a data sequence Ix,,, xi, . . . , s,,, . ) be a 1-D first-order Markov process of correlation coefficient I x, i.e.,
where cov[x,y] The smallest follows: 1 z:,=2x,+Tx”+l,
I, z,
=
x,z -
x,+
1%
where the rounding operations are also disregarded. The transform produces two kinds of transformed data sequences, (z;, z;, . zi, . . 1’ and 3. Fig. 1 depicts the computation z;;, z;, . . . , z;, . { at procedure of the ULWHT with two transform stages. It shows that two kinds of data sequences transformed in the present stage will be introduced into the next stage as two pairs such as (zb z;,+ J and (zi, zi,,), respectively. Their covariances can be obtained and are given by
r,(l + rJ”o; (27)
-
4
(23)
3 _* zzl,(z)dz+~~~zzi,-iz)dz).
Then, according,
denotes the covariance of x: and y. transformation can be rewritten as
1
Note that J(z) is not Gaussian, but it may be very close to a Gaussian function. The variance of the random variable z can be obtained from Eq. (23). 1 Of = 2
(26)
covcx,, & +,I = &, (21)
Clearly. + (H(z’) + H(z”)) < + (H(x’) + H(x”)).
39
l/2 63 XC
I,
Z,
-1
to Eq. (18)
Cl+2 “...
“._:_:‘- . . .._ ‘..... ;::. .,........................
Clearly. Of < a.$
PRESENT STAGE
if I’, > f
(25)
The same result can be found in [9]_ Eq. (25) shows that the smallest transformation can be expected to reduce the entropy unless the correlation coefficient
.:::
,, Cl+2
NEXT STAGE
Fig. 1. Flow graph of the ULWHT with two successive transform stages. It shows that the two kinds of data sequences, I, .. . z,.z,,,z. ... . and [ . .. . zi, I::+~,.._1, are produced at the present stage and will be introduced into the next stage as two pairs of input data such as (z;,, -_:,+,I and (2,. z:;+~). respectively.
40
H.-Y. Jung et al. / Signal Processing
COVCZ~, zi+21 =
.qcxn - X,+1)(&+2-
= -
x,+3,3
rx( 1 - Y,)%;,
Tz’=
(28)
where E{ .} is the expectation operator. From Eqs. (27) and (I@, the correlation coefficient of z; and z;+~, can be derived as
63 (1997) 35-43
COVCZb> 4 + 21 f-8 + yx) = 2 2 . azz
(29)
Clearly,
(a) SYOOOO
(30)
(b)LENA
(c) MAMMOGRAM
(d) AGIOGRAM
(e) X-RAY
(f) M.R.I. Fig. 2. Original test images
H.-Y. Jung rt al. / Signal Processing
Similarly, the correlation coefficient z;+~ can be derived and is given by j*_,,=
cov[Z;, z:: + 21 = 0:.
of zl: and
63 (1997) 35 -43
41
stage may be lower than :, the variance increased.
can also
I-,( 1 + ?-,) 2
(31)
.
Then IQ1 d Il’,l,
(32)
where oz, and g$ are the variances of the random variables z’ and z” in Eq. (18). This means that the correlation coefficient of the data sequences to be introduced into the next successive transformation stage are always smaller than those of the input sequence at the present stage. Hence. when using a codebook for each transform coefficient, the ULWHT, regardless of the correlation coefficient, reduces the entropy by enlarging the block size of the transform. However, in the case of using one and the same codebook, the total entropy will be increased for large enough block size. Since the correlation coefficients of the data to be introduced into the next transform
5. Simulation
results
In our simulation, we assume that all transform coefficients are entropy coded at the same time. Six images of size 512 x 512 with 8 bits/pixel are used as test images because of their distinct characteristics (see Fig. 2). ‘SYOOO’ and ‘LENA’ are natural and face scenes, respectively. The other are medical images; ‘MAMMOGRAM’, cardiac ‘ANGIOGRAM’, chest ‘X-RAY’, and head ‘M.R.I.‘. To evaluate the performance of the proposed ULWHT in terms of the total lossless first-order entropy, simulations were carried out by varying the size of the non-overlapping block. The results are summarized in Fig. 3. Here, the block size varies from 2 x 2 to 2” x 29 and the case of 1 x 1 (M = 0) denotes the entropy of the original image. The results indicate that using the 23 x 2” (M = 3) block size results in the lowest entropy on all the test images. In the application of the ULWHT to lossless pyramid structured coding, simulations were carried
8
--
SYOOO ---
0
3
6
LENA
-‘-
ANOO.
A
MAMb.42
--
M.R I.
---f~--
X-RAY
9
Blcck size @4
Fig. 3. Simulation results in terms of first-order entropy as varying the block size of the ULWHT, from 2 x 2 to 2” x 2”. Each block size is 2M x 2” (M = 0. 1. (9) and the case of 1 x 1 (M = 0) denotes the entropy of the original image. In these experiments we assume that all transform coefficients are coded at the same time.
H.-Y. Jung et al. / Signal Processing 63 (1997) 35-43
42
Table 1 Simulation results in terms of the total lossless first-order entropy, assuming all transform coefficients to be coded at one time. The use of size 2 x 2 in 2-D ULWHT based lossless pyramid structured coding corresponds to the S-transform Total lossless first-order entropy
Images SYOOO
LENA MAMMOGRAM ANGIOGRAM X-RAY M.R.I.
Original entropy
HEDI RDP
N x N 2-D ULWHT-based pyramid structured coding (2 x 2) (4 x 4) (8 x 81
7.846 7.594 7.517 6.857 6.667 5.125
6.258 5.168 3.886 4.169 2.925 3.698
6.035 5.092 3.716 4.133 2.77 3.425
out by varying the basic block size of the 2-D ULWHT from 2 x 2 to 23 x 23, where the size 2 x 2 corresponds to the S-Transform. The results are also compared, in terms of the total lossless first-order entropy, with other mean-based lossless pyramid-structured coding schemes such as HEDI and RDP. In this simulation, HEDI-CM2 is used because it was empirically found to yield the lowest entropy in [3]. Note that HEDI-CM2 and RDP have the same performance as reported in [2]. The simulation results are tabulated in Table 1. Employing 2 x 2 and 2’ x 2’ block sizes performs slightly better than HEDI-CM2 and RDP on the majority of test images. The smallest size ULWHT (i.e., S-transform) performs better than that of the other sizes. This is mainly caused by the fact that the correlation of the difference image
6.110 5.163 3.758 4.217 2.833 3.445
6.245 5.277 3.843 4.335 2.969 3.551
abruptly decreases to under f at the first transform stage for the case using a larger block size of ULWHT.
6. Conclusion A unified calculation form for lossless WHT was proposed. It was shown that the proposed form is more general, in that larger block sizes than in the previous schemes can be used. We proved that the ULWHT always reduces the entropy by enlarging the block size of the transform when using a codebook for each transform coefficient. Nevertheless, it is advisable to use the smallest size ULWHT in the ULWHT-based lossless pyramid-structured coding schemes.
Appendix A.
Using the properties expressed as follows: W 8X8 =
of tensor product, 23 x 23 size integer Walsh-Hadamard
matrix W8 x 8 can be
w2x2ow2x2ow2x2
(A.11
H.-Y. Jung et 01. / Signal Processing
A.1.
xM
xN
L.i
r.1
matrix of size M x N identity matrix of size N x floor operation ceiling operation set of integer numbers set of real numbers tensor product random variable normal probability density jointly normal probability expected value of x variance of x correlation coefficient of x covariance of x and 4’ expectation operator
N
function density function
and y
References
[2]
[3]
[4] [S] [6]
[7]
43
Notutions
I NXV
[I]
63 11997j 35.- 43
H. Blume, A. Fand, Reversible and irreversible image data compression using the S-Transform and LempellZiv coding. Proc. SPIE Medical Imaging III: Image Capture and Display, Vol. 1091, 1989, pp. 2-18. H.Y. Jung, T.Y. Choi, II. Prost, Rounding transform for lossless image coding, IEEE ICIP-96, Lausanrte, Switzerland, Vol. 1. September 1996, pp. 65568. W.Y. Kim, P.T. Balsara, D.T. Harper III, J.W. Park, Hierarchy embedded differential images for progressive transmission using lossless compression, IEEE Trans. Circuits and Systems for Video Technol. 5 (1) (1995) l-13. P. Lux. A novel set of closed orthogonal functions for picture coding, Arch. Elek. Ubertragung 31 (1997) 2677274. A. Papoulis, Probability, Random Variables, and Stochastic Processes, 2nd ed., McGraw-Hill, New York, 1984. M. Rabbani, P.W. Jones, Digital Image Compression Techniques, SPIE Optical Engineering Press, Bellingham. Washington, 1991. T.V. Ramabadran, K. Chen. The use of contextual informatton in the reversible compression of medical images. lEEE Trans. Medical Imaging I I (2) (June 1992) 1855195.
[S] P. Roos, M.A. Viergever, M.C.A. Van Dijke, J.H. Peters, Reversible intraframe compression of medical images. IEEE Trans. Medical Imaging 7 (4) (December 1988) 328-336. [9] A. Said, W.A. Pearlman, An image multiresolution representation for lossless and lossy compression, IEEE Trans. Image Process. 5 (9) (September 1996) 1303 -13 10. [IO] I.A. Shah, 0. Akiwumi-Assani, B. Johnson, A chip set for lossless image compression, IEEE J. Solid-State Circutts. 26 (3) (March 1991) 237-244. [I I] L. Wang, M. Goldberg, Reduced-difference pyramid: A data structure for progressive image transmission, Opt. Engrg. 28 (7) (July 1989) 7088716. [I21 Th. Wendler, D. Meyer-Ebrecht, Proposed standard for variable format picture processing and a codec approach to match diverse imaging devices, Proc. SPIE Picture Archiving & Communicating Systems (PACS) for Medical Applications, Vol. 318, 1982, pp. 2988305. [I31 A. Zandi, J. Allen, E. Schwartz, M. Boliek, CREW: Compression with reversible embedded wavelets. IEEE Data Compression Conf. Snowbrid. Utah, USA. March 1995. pp. 212 -221.