The method and corresponding algorithm for hierarchical bypass of minimum code units (MCU - blocks of 8 x 8 pixels) in the process of preprocessing of lossless image compression is proposed. The algorithm for selecting for each MCU an effective difference color model with integer coefficients from the list of basic alternative models, which predictable minimizes the image compression ratio based on entropy analysis is given. An algorithm for compact hierarchical storage of numbers of selected difference color models for each MCU, which takes into account the high probability of repetition of these numbers for adjacent MCUs is described and implemented. It is shown that both color models for individual MCUs and a single color model for the entire image can be effective for difference images. To evaluate the effectiveness of preprocessing algorithms during hierarchical compression, the feasibility of using the weighted average entropy by passes instead of the total entropy, which is calculated only by pixels processed by a context-independent algorithm is proposed. It is noted that the entropy by 4 passes is always less than the total entropy, because it takes into account the different unevenness of the probability distribution of elements on different passes, that is why it is advisable to store the data of different passes in different compressed blocks. On the well-known Archive Comparison Test suite, it has been demonstrated that applying integer difference color models to MCU image fragments with the option of switching to a single difference color model for the entire image can reduce compression ratios by an average of 0.02 bpb but at the same time slows down the encoding by a factor of 2.88 and decoding by 3.39%, so such preprocessing is not recommended to be used in graphic formats. It is emphasized that difference color models should be applied to individual MCUs in archivers in order to ensure maximum lossless image compression.
Read full abstract