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
68 lines
2.0 KiB
C++
68 lines
2.0 KiB
C++
// File: crn_assert.h
|
|
// See Copyright Notice and license at the end of inc/crnlib.h
|
|
#pragma once
|
|
|
|
const unsigned int CRNLIB_FAIL_EXCEPTION_CODE = 256U;
|
|
void crnlib_enable_fail_exceptions(bool enabled);
|
|
|
|
void crnlib_assert(const char* pExp, const char* pFile, unsigned line);
|
|
void crnlib_fail(const char* pExp, const char* pFile, unsigned line);
|
|
|
|
#ifdef NDEBUG
|
|
#define CRNLIB_ASSERT(x) ((void)0)
|
|
#undef CRNLIB_ASSERTS_ENABLED
|
|
#else
|
|
#define CRNLIB_ASSERT(_exp) (void)((!!(_exp)) || (crnlib_assert(#_exp, __FILE__, __LINE__), 0))
|
|
#define CRNLIB_ASSERTS_ENABLED
|
|
#endif
|
|
|
|
#define CRNLIB_VERIFY(_exp) (void)((!!(_exp)) || (crnlib_assert(#_exp, __FILE__, __LINE__), 0))
|
|
|
|
#define CRNLIB_FAIL(msg) \
|
|
do { \
|
|
crnlib_fail(#msg, __FILE__, __LINE__); \
|
|
} while (0)
|
|
|
|
#define CRNLIB_ASSERT_OPEN_RANGE(x, l, h) CRNLIB_ASSERT((x >= l) && (x < h))
|
|
#define CRNLIB_ASSERT_CLOSED_RANGE(x, l, h) CRNLIB_ASSERT((x >= l) && (x <= h))
|
|
|
|
void trace(const char* pFmt, va_list args);
|
|
void trace(const char* pFmt, ...);
|
|
|
|
// Borrowed from boost libraries.
|
|
template <bool x>
|
|
struct crnlib_assume_failure;
|
|
template <>
|
|
struct crnlib_assume_failure<true> {
|
|
enum { blah = 1 };
|
|
};
|
|
template <int x>
|
|
struct crnlib_assume_try {};
|
|
|
|
#define CRNLIB_JOINER_FINAL(a, b) a##b
|
|
#define CRNLIB_JOINER(a, b) CRNLIB_JOINER_FINAL(a, b)
|
|
#define CRNLIB_JOIN(a, b) CRNLIB_JOINER(a, b)
|
|
#define CRNLIB_ASSUME(p) typedef crnlib_assume_try<sizeof(crnlib_assume_failure<(bool)(p)>)> CRNLIB_JOIN(crnlib_assume_typedef, __COUNTER__)
|
|
|
|
#ifdef NDEBUG
|
|
template <typename T>
|
|
inline T crnlib_assert_range(T i, T) {
|
|
return i;
|
|
}
|
|
template <typename T>
|
|
inline T crnlib_assert_range_incl(T i, T) {
|
|
return i;
|
|
}
|
|
#else
|
|
template <typename T>
|
|
inline T crnlib_assert_range(T i, T m) {
|
|
CRNLIB_ASSERT((i >= 0) && (i < m));
|
|
return i;
|
|
}
|
|
template <typename T>
|
|
inline T crnlib_assert_range_incl(T i, T m) {
|
|
CRNLIB_ASSERT((i >= 0) && (i <= m));
|
|
return i;
|
|
}
|
|
#endif
|