7b6f456399
This change significantly improves compression speed. Explanation: The main ideas used for selector computations optimization: - possible pixel values for each endpoint can be cached - the distances between the possible pixel values and the actual pixels values within a block can be cached for fast error computation during selector assignment - selector refinement can be efficiently integrated with the selector assignment, as it is based on the same set of cached error values - using block encoding instead of chunk encoding for both endpoints and selectors eliminates extra levels of indirection Testing: The modified algorithm has been tested on the Kodak test set using 64-bit build with default settings (running on Windows 10, i7-4790, 3.6GHz). All the decompressed test images are identical to the images being compressed and decompressed using original version of Crunch. [Compressing Kodak set without mipmaps] Original: 1582222 bytes / 28.953 sec Modified: 1494501 bytes / 19.667 sec Improvement: 5.54% (compression ratio) / 32.07% (compression time) [Compressing Kodak set with mipmaps] Original: 2065243 bytes / 36.998 sec Modified: 1945365 bytes / 25.642 sec Improvement: 5.80% (compression ratio) / 30.69% (compression time)