// Quality setting = the higher the quality, the slower.
// To pack large textures, it is highly recommended to call pack_etc1_block() in parallel, on different blocks, from multiple threads (particularly when using cHighQuality).
enumetc1_quality
{
cLowQuality,
cMediumQuality,
cHighQuality,
};
structetc1_pack_params
{
etc1_qualitym_quality;
boolm_dithering;
inlineetc1_pack_params()
{
clear();
}
voidclear()
{
m_quality=cHighQuality;
m_dithering=false;
}
};
// Important: pack_etc1_block_init() must be called before calling pack_etc1_block().
voidpack_etc1_block_init();
// Packs a 4x4 block of 32bpp RGBA pixels to an 8-byte ETC1 block.
// 32-bit RGBA pixels must always be arranged as (R,G,B,A) (R first, A last) in memory, independent of platform endianness. A should always be 255.
// Returns squared error of result.
// This function is thread safe, and does not dynamically allocate any memory.
// pack_etc1_block() does not currently support "perceptual" colorspace metrics - it primarily optimizes for RGB RMSE.