3e12aff909
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.866 sec
Modified: 1468204 bytes / 11.858 sec
Improvement: 7.21% (compression ratio) / 58.92% (compression time)
[Compressing Kodak set with mipmaps using DXT1 encoding]
Original: 2065243 bytes / 36.878 sec
Modified: 1914805 bytes / 15.625 sec
Improvement: 7.28% (compression ratio) / 57.63% (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: 17.181 sec
Average bitrate: 1.363 bpp
Average Luma PSNR: 34.050 dB
28 lines
756 B
C++
28 lines
756 B
C++
// File: ryg_dxt.hpp
|
|
#pragma once
|
|
|
|
#include "crn_ryg_types.hpp"
|
|
|
|
namespace ryg_dxt {
|
|
extern sU8 Expand5[32];
|
|
extern sU8 Expand6[64];
|
|
extern sU8 OMatch5[256][2];
|
|
extern sU8 OMatch6[256][2];
|
|
extern sU8 OMatch5_3[256][2];
|
|
extern sU8 OMatch6_3[256][2];
|
|
extern sU8 QuantRBTab[256 + 16];
|
|
extern sU8 QuantGTab[256 + 16];
|
|
|
|
// initialize DXT codec. only needs to be called once.
|
|
void sInitDXT();
|
|
|
|
// input: a 4x4 pixel block, A8R8G8B8. you need to handle boundary cases
|
|
// yourself.
|
|
// alpha=sTRUE => use DXT5 (else use DXT1)
|
|
// quality: 0=fastest (no dither), 1=medium (dither)
|
|
void sCompressDXTBlock(sU8* dest, const sU32* src, sBool alpha, sInt quality);
|
|
|
|
void sCompressDXT5ABlock(sU8* dest, const sU32* src);
|
|
|
|
} // namespace ryg_dxt
|