EXPLOITING LOCAL COLOUR DEPENDENCIES in BINARY TREE PREDICTIVE CODING J a Robinson University of York, UK. INTRODUCTION Bina
Total Page:16
File Type:pdf, Size:1020Kb
EXPLOITING LOCAL COLOUR This paper reports developments aimed at DEPENDENCIES IN solving the above technical problems and up- BINARY TREE PREDICTIVE CODING dated experimental comparisons showing that the latest version of BTPC remains competi- J A Robinson tive for general-purpose image coding. University of York, UK. BTPC METHOD INTRODUCTION In common with a small number of other pre- dictive coding schemes (e.g. [3-5]), BTPC Binary Tree Predictive Coding (BTPC) is a divides an input picture into rasters of pels, general-purpose compression scheme for still evenly subsampled from the original, with the images. Its design criteria are: rasters coded in order of increasing density. In • Good rate/distortion performance for both the example block of image pels shown in fig- lossy and lossless compression of all im- ure 1, the coding order is A1, A2, A3, A4, B1, age types (including photographs, line C1, C2, … , E11, E12. graphics, text images, high-quality shaded graphics, and medical images). A1 E1 C1 E2 A2 • Fast operation, particularly for decoding • Patent-free E3 D1 E4 D2 E5 When initially reported [1], BTPC was com- C2 E6 B1 E7 C3 pared with JPEG, GIF and research coders of that time, SPIHT and CALIC. It outperformed E8 D3 E9 D4 E10 JPEG and GIF (except for limited-palette col- our graphics) but was inferior to SPIHT and A3 E11 C4 E12 A4 CALIC in their respective areas of strength. Figure 1. Example block of image pels Tested with an assortment of images of differ- showing membership in five rasters. ent modalities, BTPC was the most consistent overall performer, other coders faring poorly A pel in the current raster is predicted from on image types outside their design limits. pels in the previous and current rasters that surround it spatially, for example E6 is pre- An implementation of BTPC (version 4.1) has dicted from E3, D1, E4, C2, B1 and D3. The been available online since 1997. This has method is therefore interpolative. BTPC differs been widely downloaded, tested and applied. from other such schemes in that its predictions are non-linear, and adaptive to luminance sur- On its initial release, two problems were iden- face shape (and thereby to different types of tified with BTPC: picture content). Prediction errors are arranged • The most visible coding artifact at low into a binary tree structure for efficient coding data rates is contouring. This effect should of blocks of zeros. For example, B1 is the par- be reduced, even at the expense of objec- ent of C1 and C2, which in turn are parents of tive quality (PSNR). D1 and D2, and D3 and D4 respectively. A • BTPC performs significantly poorer than leaf codeword at B1 indicates that all descen- GIF for limited-palette, highly-structured dents are predicted without error. A set of colour graphics, where colour quantization Huffman coders provides backend lossless allows very high compression. coding of prediction errors and tree leaves. Today, the most telling problem for BTPC is Details of the original method are provided in that the research systems against which it was [1] and an improvement is documented in [6]. compared have been superseded by standards. JPEG-LS and JPEG 2000 not only out- NEW DEVELOPMENTS compress SPIHT and CALIC [2], but fast im- plementations are available. Moreover, GIF I have conducted systematic experiments now has a standard patent-free replacement in aimed at improving BTPC’s performance rela- PNG, and although JPEG 2000 is subject to tive to the current standards. Some of this many patents, the JPEG 2000 committee has work has produced improvements for both negotiated royalty-free use of all the algo- monochrome and colour image coding: rithms in the core method. Thus BTPC’s lack • The predictor adaptation to local lumi- of patents is no longer a telling advantage. nance variance has been reformulated to reduce the visibility of contouring on pho- tographic images. Essentially this means using more pels in the predictor in areas of rent pel if all pels below it in the tree, in all low variation. three components, are predicted without error. • The coding of Huffman tables has been The use of the modified predictor, described improved so that small pictures are com- above, increases the number of zeros in the pressed more efficiently. second and third components, so the leaf- • The Huffman coders now incorporate codeword overhead is only slightly greater runlength coding where this provides a than that for coding the first component only. benefit, so that large pictures are com- pressed more efficiently. The improvements described above plus nu- Other investigations resulted in small overall merous smaller changes have been incorpo- improvement at significant computational cost, rated into BTPC version 5. so have not been incorporated in the next re- lease version of BTPC. These include EXPERIMENTS • Adaptation of the Huffman code tables dependent on signal level and local activ- BTPC 5 was compared against the following ity. systems: • Vector predictions for simultaneous cod- JPEG-LS (LOCO I) -- The Hewlett-Package ing of three colour channels. locoe/locod implementation [7]. Experiments However, two investigations focused on ex- used all three sample, line and plane interleav- ploiting the local dependencies between colour ing options, and the one that compressed most channels did yield significant improvements. was chosen for each image. (Sometimes this was not the option recommended for a particu- Linking prediction across colour channels lar image type.) JPEG 2000 -- The Kakadu V3.4 implementa- Most colour image coding schemes exploit tion [8]. Equal weighting of colour channels statistical correlations between colour compo- was used to maximize PSNR. nents through a global transformation of the GIF encoding was independently done with the colour space – typically a fixed transform from ImageMagick convert tool and the image R,G,B to Y,C1,C2. BTPC 5 uses a global viewer xv. These palletize differently and give transform which is based on the statistics of different compression rates. The better was the image. However, an adaptive predictive chosen in each case. coding scheme is also able to exploit local de- PNG encoding was done with the Image pendencies between components. In BTPC, Magick convert tool. this works as follows: The first component Baseline JPEG -- The Independent JPEG recovered from a prediction and a non-zero Group’s implementation. This rescales input prediction error is compared, after decoding, images to [0,255] so images were pre- and with the prediction region and used to select a post- processed to ensure fair PSNR results. predictor that would have been better than the BTPC 5 -- The new version of BTPC incorpo- one used. This modified predictor is then used rating the improvements described above. for the remaining two components if their local prediction surfaces are of similar shape. This The experiments are summarized with repre- method means that prediction of components 2 sentative and BTPC worst-case examples in and 3 (typically the chrominance) is based on figures 2 to 8. For lossless coding, only the the spatial structure of component 1, which better of GIF and PNG is shown in each case. normally yields a significant reduction in the prediction error for those components. DISCUSSION AND CONCLUSIONS Integrated coding of zero prediction errors BTPC, even with its improvements, underper- forms its best competitors in their areas of An integrated binary tree over all three colour strength. However, the degree of underperfor- channels provides more efficient coding of mance is, arguably, minor, compared to blocks of zeros. I investigated a number of BTPC’s advantage of good performance across structures for simultaneous coding of zeros in all image types. colour images, including a hex-tree structure wherein codewords could signify that any For lossless compression of photographs, combination of the three colour channels had JPEG-LS outperforms BTPC (and PNG) by 0- all zeros below the current pel. However, the 10%. For lossy compression of photos, JPEG relatively simple binary tree proved to be al- 2000 beats BTPC by between 0 and 2 dB over most as data-rate efficient and far faster. This all usable bitrates. Although subjective tests modification sends a leaf codeword at the cur- have not been performed, figure 2 allows com- parison of JPEG 2000 and BTPC at equal bi- [4] L Arnold, “Interpolative Coding of Images trates and at equal PSNRs. This illustrates that with Temporally Increasing Resolution,” Sig- PSNR may favour JPEG 2000 relative to sub- nal Processing, Vol 17, pp 151-160, 1989 jective judgement. BTPC’s relative perform- [5] R L de Quieroz, D A F Florencio, R W ance improves for smaller images: below 100 Shafer, “Nonexpansive Pyramid for Image x 100 pels it is usually competitive with JPEG Coding using a Nonlinear Filterbank”, IEEE 2000, even on PSNR terms, making it equally Trans Im Proc, Vol 7, No 2, pp 246-252, 1998. efficient for any application where large im- [6] J A Robinson, “In-Band Redundancy Re- ages are sliced (e.g. in web-based interactive moval for Binary Tree Predictive Coding”, applications). For lossless compression of Proc First Internat Symposium on Communi- graphics, BTPC is inferior to the better of GIF cation Systems and Digital Signal Processing, and PNG, and where palettization is possible, Sheffield, UK, 6-8 April 1998, pp 52-55. it can still be significantly worse. However, it [7] M Weinberger, G Seroussi, G Sapiro, achieves lossy coding of graphics without visi- “LOCO-I: A Low Complexity, Context-Based, ble artifacts at well below the GIF and PNG Lossless Image Compression Algorithm, “ rates, and is also much better than any other Proc IEEE Data Compression Conference, lossy system for graphics.