make it compile

faster-single-tables
Andrew Cassidy 3 years ago
parent 2d9abcc15f
commit 7d830daee3

@ -55,6 +55,8 @@
#include <cstdint>
#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
/*
------------------------------------------------------------------------------

@ -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 <typename S> 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<BC3Block *>(&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<BC5Block *>(pBlock), &pixels[0].m_c[0], bc45_channel0, bc45_channel1, 4);
break;
}
case DXGI_FORMAT_BC7_UNORM:

Loading…
Cancel
Save