|
|
@ -569,7 +569,7 @@ void EtcLibCompressor::compress(AlphaMode alphaMode, uint w, uint h, uint d, con
|
|
|
|
#if defined(HAVE_RGETC)
|
|
|
|
#if defined(HAVE_RGETC)
|
|
|
|
#include "rg_etc1.h"
|
|
|
|
#include "rg_etc1.h"
|
|
|
|
|
|
|
|
|
|
|
|
NV_AT_STARTUP(rg_etc1::pack_etc1_block_init());
|
|
|
|
NV_AT_STARTUP(rg_etc1::pack_etc1_block_init()); // @@ Do this in context init.
|
|
|
|
|
|
|
|
|
|
|
|
void RgEtcCompressor::compressBlock(ColorBlock & rgba, AlphaMode alphaMode, const CompressionOptions::Private & compressionOptions, void * output)
|
|
|
|
void RgEtcCompressor::compressBlock(ColorBlock & rgba, AlphaMode alphaMode, const CompressionOptions::Private & compressionOptions, void * output)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -591,6 +591,60 @@ void RgEtcCompressor::compressBlock(ColorBlock & rgba, AlphaMode alphaMode, cons
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_ETCPACK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EtcPackCompressor::compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * data, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint8 *imgdec = (uint8 *)malloc(expandedwidth*expandedheight * 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32 block1, block2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (compressionOptions.quality == Quality_Fastest) {
|
|
|
|
|
|
|
|
compressBlockDiffFlipFast(img, imgdec, expandedwidth, expandedheight, 4 * x, 4 * y, block1, block2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
compressBlockETC1Exhaustive(img, imgdec, expandedwidth, expandedheight, 4 * x, 4 * y, block1, block2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_ETCINTEL)
|
|
|
|
|
|
|
|
#include "kernel_ispc.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EtcIntelCompressor::compress(nvtt::AlphaMode alphaMode, uint w, uint h, uint d, const float * data, nvtt::TaskDispatcher * dispatcher, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nvCheck(d == 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allocate and convert input.
|
|
|
|
|
|
|
|
nv::Array<uint8> src;
|
|
|
|
|
|
|
|
const uint count = w * h;
|
|
|
|
|
|
|
|
src.resize(4 * count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < count; i++) {
|
|
|
|
|
|
|
|
src[4 * i + 0] = data[count * 0 + i]; // @@ Scale by 256?
|
|
|
|
|
|
|
|
src[4 * i + 1] = data[count * 1 + i];
|
|
|
|
|
|
|
|
src[4 * i + 2] = data[count * 2 + i];
|
|
|
|
|
|
|
|
src[4 * i + 3] = data[count * 3 + i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int bw = (w + 3) / 4;
|
|
|
|
|
|
|
|
int bw = (w + 3) / 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allocate output.
|
|
|
|
|
|
|
|
nv::Array<uint8> dst;
|
|
|
|
|
|
|
|
dst.resize(bw * bh * 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ispc::rgba_surface surface;
|
|
|
|
|
|
|
|
surface.ptr = src.buffer();
|
|
|
|
|
|
|
|
surface.width = w;
|
|
|
|
|
|
|
|
surface.height = h;
|
|
|
|
|
|
|
|
surface.stride = w * 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ispc::CompressBlocksBC1_ispc(&surface, dst)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_PVRTEXTOOL)
|
|
|
|
#if defined(HAVE_PVRTEXTOOL)
|
|
|
|
|
|
|
|
|
|
|
|