The sum of squared differences between adjacent block edge pixels is a measure of blockiness that tends to increase with the amount of compression. A similar measure taken away from the block edge provides an estimate of the blockiness in the original image. We find that lowering the blockiness value to this estimate, while limiting coefficient change to the quantization level, can reduce both apparent blockiness and RMS (root mean square) error. The spatial frequency weighted contrast energy measures image roughness. Some additional advantage results from restoring the within-block image roughness if the blockiness reduction has increased it.
The goal of this project was the development of algorithms for improving the quality of images that have already been compressed by a JPEG-like scheme in which the image is divided up into blocks, each block is converted to DCT coefficients, and these coefficients are then quantized. In JPEG there follows a stage of lossless encoding that we ignore for the present purpose. We assume that we have the quantized coefficients and the matrix of quantization values. Our problem is to find an image that is more like the original image than the image obtained simply by performing the inverse DCT on the quantized coefficients.
Figure 1 shows five images. The center image is the original image. The upper left and lower left images have been quantized and restored without any de-blocking. The upper right and lower right show the corresponding images after our de-blocking algorithm is applied. Our method can be described as follows:
1) Measure the blockiness of the image and estimate how blocky it should be.
2) Lower the blockiness to the estimate.
3) Ensure that all DCT coefficients quantize to those of the compressed image.
4) If the within-block roughness of the image has increased, restore it to its original value.
5) Ensure that all DCT coefficients quantize to those of the compressed image.
In the rest of the paper, we make this description more precise, show quantitative results for this image and the four other images of Figure 2, and relate our work to that of others. We conclude that if this method is used when the quantization is strong enough to generate significant block artifacts, moderate de-blocking results with no increase in the RMS image error.
I(u,v) = SUMx(SUMy(i(x,y)*c(x,u)*c(y,v))), x,y,u,v = 0,N-1, (1a)
where
c(x,u) = alpha(u)*cos(pi*u*(2*x+1)/2N), (1b)
and
alpha(u) = sqrt(1/N) , u = 0
or
alpha(u) = sqrt(2/N) , u > 0 (1c)
S(u,v) = Round(I(u,v)/Q(u,v)). (2)
The compressed image contains both the S(u,v) for all the blocks and the Q(u,v). To retrieve the image, first the DCT coefficients are restored (with their quantization error) by
I'(u,v) = S(u,v)*Q(u,v), (3)
where Q(u,v) denotes the quantizer step size used for coefficient I(u,v). The blocks of image pixels are reconstructed by the inverse transform:
i'(u,v) = SUMu(SUMv(I'(u,v)*c(x,u)*c(y,v))), (4)
which for this normalization is the same as the forward transform. Our goal is to find better estimates of these coefficients.
E = SUM((i1-i2)*(i1-i2)), (5)
The block edge variance E is our measure of image blockiness.
i(1,y) = SUMu,v(I(1,u,v)*c(7,u)*c(y,v)) = SUMv(c(y,v))*SUMu(I(1,u,v)*c(7,u)). (6)
Since the DCT is an orthonormal decomposition, the edge variance for these blocks is
E(1,2) = SUMy((i(1,y)-i(2,y))^2)
= SUMv((SUMu(I(1,u,v)*c(7,u))-SUMu(I(2,u,v)*c(0,u)))^2)
= SUMu(SUMv((c(0,u)^2*(I(1,u,v)-(-1)^u*I(2,u,v))^2)). (7)
This formula takes advantage of the fact that
c(0,u) = (-1)^u*c(7,u). (8)
The weighting of the sums or differences by c(0,u), shows that for a vertical edge, errors in the high vertical frequencies have little effect on the edge variance, because the high frequency DCT basis functions have little amplitude at the block edge.
We estimate the desired value of the edge variance by computing the same measure for the pixels just inside the edge on either side and taking the average. If this estimate is less than the edge variance, we attempt to reduce the edge variance to this value. This reduction is done in the direction of the gradient of edge variance and may not be completely achieved if the minimum reduction in this direction is above the next-to-edge variance.
Adjusting the edge variance in this way only alters the edge pixels. The problem has been reduced at the boundary, but a new problem has been created inside the blocks. We attempt to reduce this problem by monitoring a measure of image roughness in the blocks.
R = SUMu,v(u*u+v*v)*I(u,v)*I(u,v), (9)
summed over all blocks. By weighting each component I(u,v) by its spatial frequency we obtain a measure closely related to the total edge variance inside the block. If this measure increases after reducing the edge variance, we attempt to return it to its original value by changing it along its gradient.
MINi'(Ei(d(i',i)|gamma)).
where gamma is the encoded image. They point out that if d is the sum of squared differences between pixel values, then the optimal decoder is
i' =Ei(i|gamma).
In an earlier paper [Ref. 4], they applied this concept to the derivation of optimal additive contribution to the block for each possible level of each DCT coefficient. Their (NLI) decoder gave a 0.7 dB improvement in mean square error on a diverse 23 image training set and about 0.5 dB improvement on new images. They report apparent reduction in blockiness, but since the method was restricted to within blocks, it does not directly attack the problem. We hope to try a generalization of the method, finding the optimal additive contribution to the block and the surrounding block from each coefficient. This method of reconstruction is inherently fast and the large memory requirement can probably be reduced by parametric representations of the tables (which probably will also increase the generalizability). This method is inherently adaptable to local image statistics.
Stevenson [Ref. 5] has analyzed this problem from the maximum (MAP) point of view. The goal is to find the image i' that maximizes the probability of the image given the quantized image i'. That is, the image that maximizes
MAXi^Prob[i^|i'].
Using a non-Gaussian Markov random field model for the image distribution, the resulting solution is the minimum of a roughness function similar to ours with the squaring operation replaced by a Huber operation in the space domain. The quantization constraint is also enforced. The method appears to strongly reduce blocking for the Lena picture, JPEG compressed at 30 to 1, but no quantitative measures are reported. The Huber function is reported to allow edges in the original image to persist through the smoothing, but the value of the Huber threshold T is not given and presumably would have to be set higher than Q so that the block edges would be smoothed. It would be interesting to test the relative advantage of using the Huber function in the space domain rather than simple squaring, which can be done as well in either domain. Another question that is raised is the relative value of specialized smoothing at the block boundaries versus a single overall measure of roughness.
Our methods and results are similar to the iterative projection method of Yang, Galatsanos, and Katsaggelos [Ref. 6], They also use edge variance and the quantization constraint. They compute separate horizontal and vertical edge variances and force them to their correct values in the original image by a weighted averaging of edge pixels. They iterate these two constraints in conjunction with the quantization constraint and range constraints in both the space and DCT domains. Since the constraints are projections onto convex sets, iterating them is guaranteed to terminate, since the original image is a solution. They report a 1 dB improvement in RMS error of reconstruction and strong apparent reduction in the blockiness for the 256x256 Lena image when the PSNR for the original reconstruction was 27.9 dB. Our method differs from their method mainly in the addition of the within block smoothness constraint and the estimation of the edge variance. We find that iterating our constraints can lead to to better performance at high levels of quantization, but can degrade performance at lower levels.
2. W. B. Pennebaker, J. L. Mitchell, JPEG Still Image Data Compression Standard, van Nostrand Reinhold, New York, 1993.
3. S. Wu, A. Gersho, "Enhanced video compression with standardized bit stream syntax", ISCASSP '93, vol. I, pp. 103- 106, 1993.
4. S. Wu, A. Gersho, "Enhancement of transform coding by nonlinear interpolation", Visual Communications and Image Processing '91: Visual Communication vol. 1605, SPIE, Bellingham, WA, pp. 487-498, 1991.
5. Robert L. Stevenson, "Reduction of coding artifacts in transform image coding", ISCASSP '93, vol. V, pp. 401-404, 1993.
6. Y. Yang, N. Galatsanos, A. Katsaggelos, "Iterative Projection algorithms for removing the blocking artifacts of block-DCT compressed images", ISCASSP '93, vol. V, pp. 405-408, 1993.