From 7d830daee375fb5a25d38d972cf26a3ee737fb6f Mon Sep 17 00:00:00 2001 From: drewcassidy Date: Fri, 5 Feb 2021 23:22:57 -0800 Subject: [PATCH] make it compile --- src/rgbcx.h | 10 ++++++---- src/test/test.cpp | 8 ++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/rgbcx.h b/src/rgbcx.h index 8a3b0e7..19653c4 100644 --- a/src/rgbcx.h +++ b/src/rgbcx.h @@ -55,6 +55,8 @@ #include +#include "blocks.h" + // By default, the table used to accelerate cluster fit on 4 color blocks uses a 969x128 entry table. // To reduce the executable size, set RGBCX_USE_SMALLER_TABLES to 1, which selects the smaller 969x32 entry table. #ifndef RGBCX_USE_SMALLER_TABLES @@ -173,8 +175,8 @@ void encode_bc1(void *pDst, const uint8_t *pPixels, uint32_t flags = 0, uint32_t // There are two encode_bc3() functions. // The first is the recommended function, which accepts a level parameter. // The second is a low-level version that allows fine control over BC1 encoding. -void encode_bc3(uint32_t level, void *pDst, const uint8_t *pPixels); -void encode_bc3(void *pDst, const uint8_t *pPixels, uint32_t flags = 0, uint32_t total_orderings_to_try = DEFAULT_TOTAL_ORDERINGS_TO_TRY); +void encode_bc3(uint32_t level, BC3Block *pDst, const uint8_t *pPixels); +void encode_bc3(BC3Block *pDst, const uint8_t *pPixels, uint32_t flags = 0, uint32_t total_orderings_to_try = DEFAULT_TOTAL_ORDERINGS_TO_TRY); // Encodes a single channel to BC4. // stride is the source pixel stride in bytes. @@ -182,7 +184,7 @@ void encode_bc4(void *pDst, const uint8_t *pPixels, uint32_t stride = 4); // Encodes two channels to BC5. // chan0/chan1 control which channels, stride is the source pixel stride in bytes. -void encode_bc5(void *pDst, const uint8_t *pPixels, uint32_t chan0 = 0, uint32_t chan1 = 1, uint32_t stride = 4); +void encode_bc5(BC5Block *pDst, const uint8_t *pPixels, uint32_t chan0 = 0, uint32_t chan1 = 1, uint32_t stride = 4); // Decompression functions. @@ -195,7 +197,7 @@ void unpack_bc4(const void *pBlock_bits, uint8_t *pPixels, uint32_t stride = 4); bool unpack_bc3(const void *pBlock_bits, void *pPixels, bc1_approx_mode mode = bc1_approx_mode::cBC1Ideal); void unpack_bc5(const void *pBlock_bits, void *pPixels, uint32_t chan0 = 0, uint32_t chan1 = 1, uint32_t stride = 4); -} // namespace rgbcx +} // namespace rgbcx /* ------------------------------------------------------------------------------ diff --git a/src/test/test.cpp b/src/test/test.cpp index 2dab40c..f0c7051 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -20,10 +20,6 @@ const int MAX_UBER_LEVEL = 5; -inline int iabs(int i) { if (i < 0) i = -i; return i; } -inline uint8_t clamp255(int32_t i) { return (uint8_t)((i & 0xFFFFFF00U) ? (~(i >> 31)) : i); } -template inline S clamp(S value, S low, S high) { return (value < low) ? low : ((value > high) ? high : value); } - static int print_usage() { fprintf(stderr, "bc7enc\n"); @@ -781,7 +777,7 @@ int main(int argc, char *argv[]) } case DXGI_FORMAT_BC3_UNORM: { - block16* pBlock = &packed_image16[bx + by * blocks_x]; + BC3Block* pBlock = reinterpret_cast(&packed_image16[bx + by * blocks_x]); rgbcx::encode_bc3(bc1_quality_level, pBlock, &pixels[0].m_c[0]); break; @@ -797,7 +793,7 @@ int main(int argc, char *argv[]) { block16* pBlock = &packed_image16[bx + by * blocks_x]; - rgbcx::encode_bc5(pBlock, &pixels[0].m_c[0], bc45_channel0, bc45_channel1, 4); + rgbcx::encode_bc5(reinterpret_cast(pBlock), &pixels[0].m_c[0], bc45_channel0, bc45_channel1, 4); break; } case DXGI_FORMAT_BC7_UNORM: