This repository was archived by the owner on Sep 19, 2020. It is now read-only.
Commit 660322d
committed
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 dB1 parent c1d8e8d commit 660322d
File tree
16 files changed
+216
-55
lines changed- bin
- crnlib
- crunch
- inc
16 files changed
+216
-55
lines changedBinary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| |||
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
416 | | - | |
417 | | - | |
| 417 | + | |
| 418 | + | |
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
| |||
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
533 | 546 | | |
534 | 547 | | |
535 | 548 | | |
| |||
695 | 708 | | |
696 | 709 | | |
697 | 710 | | |
698 | | - | |
| 711 | + | |
699 | 712 | | |
700 | 713 | | |
701 | 714 | | |
| |||
773 | 786 | | |
774 | 787 | | |
775 | 788 | | |
776 | | - | |
| 789 | + | |
777 | 790 | | |
778 | 791 | | |
779 | 792 | | |
| |||
1279 | 1292 | | |
1280 | 1293 | | |
1281 | 1294 | | |
1282 | | - | |
| 1295 | + | |
| 1296 | + | |
1283 | 1297 | | |
1284 | 1298 | | |
1285 | 1299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
| 88 | + | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| |||
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
| 104 | + | |
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
121 | | - | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | | - | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| |||
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
225 | | - | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| |||
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
293 | 304 | | |
294 | 305 | | |
295 | 306 | | |
| |||
318 | 329 | | |
319 | 330 | | |
320 | 331 | | |
321 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
322 | 346 | | |
323 | 347 | | |
324 | 348 | | |
| |||
605 | 629 | | |
606 | 630 | | |
607 | 631 | | |
| 632 | + | |
608 | 633 | | |
609 | 634 | | |
| 635 | + | |
610 | 636 | | |
611 | 637 | | |
612 | | - | |
| 638 | + | |
613 | 639 | | |
614 | 640 | | |
615 | 641 | | |
616 | | - | |
| 642 | + | |
617 | 643 | | |
618 | 644 | | |
619 | 645 | | |
620 | 646 | | |
621 | 647 | | |
622 | 648 | | |
623 | 649 | | |
624 | | - | |
| 650 | + | |
625 | 651 | | |
626 | 652 | | |
627 | 653 | | |
| |||
731 | 757 | | |
732 | 758 | | |
733 | 759 | | |
734 | | - | |
| 760 | + | |
735 | 761 | | |
736 | 762 | | |
737 | 763 | | |
| |||
808 | 834 | | |
809 | 835 | | |
810 | 836 | | |
811 | | - | |
| 837 | + | |
812 | 838 | | |
813 | 839 | | |
814 | 840 | | |
| |||
946 | 972 | | |
947 | 973 | | |
948 | 974 | | |
949 | | - | |
| 975 | + | |
950 | 976 | | |
951 | 977 | | |
952 | 978 | | |
| |||
968 | 994 | | |
969 | 995 | | |
970 | 996 | | |
971 | | - | |
| 997 | + | |
972 | 998 | | |
973 | 999 | | |
974 | 1000 | | |
975 | 1001 | | |
976 | | - | |
| 1002 | + | |
977 | 1003 | | |
978 | 1004 | | |
979 | 1005 | | |
| |||
999 | 1025 | | |
1000 | 1026 | | |
1001 | 1027 | | |
1002 | | - | |
| 1028 | + | |
1003 | 1029 | | |
1004 | 1030 | | |
1005 | 1031 | | |
| |||
1012 | 1038 | | |
1013 | 1039 | | |
1014 | 1040 | | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1018 | 1044 | | |
1019 | 1045 | | |
1020 | 1046 | | |
| |||
1115 | 1141 | | |
1116 | 1142 | | |
1117 | 1143 | | |
1118 | | - | |
| 1144 | + | |
1119 | 1145 | | |
1120 | 1146 | | |
1121 | | - | |
| 1147 | + | |
1122 | 1148 | | |
1123 | 1149 | | |
1124 | 1150 | | |
| |||
1161 | 1187 | | |
1162 | 1188 | | |
1163 | 1189 | | |
1164 | | - | |
| 1190 | + | |
1165 | 1191 | | |
1166 | 1192 | | |
1167 | 1193 | | |
1168 | 1194 | | |
1169 | 1195 | | |
1170 | 1196 | | |
1171 | | - | |
| 1197 | + | |
1172 | 1198 | | |
1173 | | - | |
| 1199 | + | |
1174 | 1200 | | |
1175 | 1201 | | |
1176 | 1202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
0 commit comments