Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add compression support for ETC1S/ETC2AS encodings
Explanation: ETC1S encoding is a subset of ETC1, which is using only one color endpoint per 4x4 block. The base color is therefore is always encoded as RGB555 and there is no need to encode block flips. ETC2AS encoding is a subset of ETC2A encoding which is using ETC1S encoding for color and default ETC2A encoding for alpha. ETC1S/ETC2AS Crunch compression and decompression is based on ETC and DXT Crunch compression and decompression algorithms: - ETC1S/ETC2AS tiling is performed within the area of 8x8 pixels using DXT1/DXT5 tiling scheme - ETC1S color endpoints are generated using standard ETC1 optimization - ETC1S color codebook encoding is equivalent to ETC1 codebook encoding - ETC1S level encoding is equivalent to DXT1 level encoding - ETC2AS alpha codebook encoding is equivalent to ETC2A alpha codebook encoding - ETC2AS level encoding is equivalent to DXT5 level encoding Testing results suggest that ETC1S/ETC2AS encodings can be used to achieve lower bitrates than ETC1/ETC2A on the Kodak test set while providing equivalent image quality (estimated using PSNR). DXT 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 (revision ea9b8d8). [Compressing Kodak set without mipmaps using DXT1 encoding] Original: 1582222 bytes / 28.854 sec Modified: 1468204 bytes / 5.473 sec Improvement: 7.21% (compression ratio) / 81.03% (compression time) [Compressing Kodak set with mipmaps using DXT1 encoding] Original: 2065243 bytes / 36.925 sec Modified: 1914805 bytes / 7.297 sec Improvement: 7.28% (compression ratio) / 80.24% (compression time) ETC 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). The ETC1 quantization parameters have been selected in such a way, so that ETC1 compression gives approximately the same average Luma PSNR as the corresponding DXT1 compression (which is equal to 34.044 dB for the Kodak test set compressed without mipmaps using DXT1 encoding and default quality settings). [Compressing Kodak set without mipmaps using ETC1 encoding] Total size: 1607858 bytes Total time: 12.842 sec Average bitrate: 1.363 bpp Average Luma PSNR: 34.050 dB ETCS 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). The ETC1S quantization parameters have been selected in such a way, so that ETC1S compression gives approximately the same average Luma PSNR as the corresponding DXT1 compression (which is equal to 34.044 dB for the Kodak test set compressed without mipmaps using DXT1 encoding and default quality settings). [Compressing Kodak set without mipmaps using ETC1S encoding] Total size: 1363676 bytes Total time: 15.586 sec Average bitrate: 1.156 bpp Average Luma PSNR: 34.047 dB
- Loading branch information
Showing
with
216 additions
and 55 deletions.
- BIN bin/crunch_x64.exe
- +21 −7 crnlib/crn_comp.cpp
- +1 −0 crnlib/crn_comp.h
- +7 −0 crnlib/crn_dxt.cpp
- +2 −0 crnlib/crn_dxt.h
- +49 −23 crnlib/crn_dxt_hc.cpp
- +1 −0 crnlib/crn_dxt_hc.h
- +9 −6 crnlib/crn_dxt_image.cpp
- +1 −1 crnlib/crn_dxt_image.h
- +28 −4 crnlib/crn_mipmapped_texture.cpp
- +24 −2 crnlib/crn_pixel_format.cpp
- +19 −0 crnlib/crn_pixel_format.h
- +1 −1 crunch/crunch.cpp
- +49 −11 inc/crn_decomp.h
- +2 −0 inc/crnlib.h
- +2 −0 inc/dds_defs.h
Binary file not shown.
Oops, something went wrong.