Reenable QuickCompress for DXT5n.
Fix end of lines.
This commit is contained in:
parent
05a760b2f6
commit
d44b8e9358
@ -349,8 +349,7 @@ void nv::compressDXT5n(const Image * image, const OutputOptions::Private & outpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compress Y.
|
// Compress Y.
|
||||||
// QuickCompress::compressDXT1G(rgba, &block.color);
|
QuickCompress::compressDXT1G(rgba, &block.color);
|
||||||
compressGreenBlock_BruteForce(rgba, &block.color);
|
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
if (outputOptions.outputHandler != NULL) {
|
||||||
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
outputOptions.outputHandler->writeData(&block, sizeof(block));
|
||||||
|
@ -381,14 +381,14 @@ int InputOptions::Private::realMipmapCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Image * InputOptions::Private::image(uint face, uint mipmap) const
|
const Image * InputOptions::Private::image(uint face, uint mipmap) const
|
||||||
{
|
{
|
||||||
nvDebugCheck(face < faceCount);
|
nvDebugCheck(face < faceCount);
|
||||||
nvDebugCheck(mipmap < mipmapCount);
|
nvDebugCheck(mipmap < mipmapCount);
|
||||||
|
|
||||||
const InputImage & image = this->images[face * mipmapCount + mipmap];
|
const InputImage & image = this->images[face * mipmapCount + mipmap];
|
||||||
nvDebugCheck(image.face == face);
|
nvDebugCheck(image.face == face);
|
||||||
nvDebugCheck(image.mipLevel == mipmap);
|
nvDebugCheck(image.mipLevel == mipmap);
|
||||||
|
|
||||||
return image.data.ptr();
|
return image.data.ptr();
|
||||||
}
|
}
|
||||||
|
@ -435,10 +435,10 @@ static int computeGreenError(const ColorBlock & rgba, const BlockDXT1 * block)
|
|||||||
nvDebugCheck(block != NULL);
|
nvDebugCheck(block != NULL);
|
||||||
|
|
||||||
int palette[4];
|
int palette[4];
|
||||||
palette[0] = (block->col0.g << 2) | (block->col0.g >> 4);
|
palette[0] = (block->col0.g << 2) | (block->col0.g >> 4);
|
||||||
palette[1] = (block->col1.g << 2) | (block->col1.g >> 4);
|
palette[1] = (block->col1.g << 2) | (block->col1.g >> 4);
|
||||||
palette[2] = (2 * palette[0] + palette[1]) / 3;
|
palette[2] = (2 * palette[0] + palette[1]) / 3;
|
||||||
palette[3] = (2 * palette[1] + palette[0]) / 3;
|
palette[3] = (2 * palette[1] + palette[0]) / 3;
|
||||||
|
|
||||||
int totalError = 0;
|
int totalError = 0;
|
||||||
|
|
||||||
|
@ -45,6 +45,76 @@
|
|||||||
#define __debugsync()
|
#define __debugsync()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TN 256
|
||||||
|
#define WARP_COUNT (TN / 32)
|
||||||
|
#define HWARP_COUNT (TN / 16)
|
||||||
|
|
||||||
|
// Window size
|
||||||
|
#define WS 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct WrapClamp
|
||||||
|
{
|
||||||
|
int operator()(int i, int h)
|
||||||
|
{
|
||||||
|
i = min(max(i, 0), h-1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WrapRepeat
|
||||||
|
{
|
||||||
|
int operator()(int i, int h)
|
||||||
|
{
|
||||||
|
i = abs(i) % h; // :( Non power of two!
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WrapMirror
|
||||||
|
{
|
||||||
|
int operator()(int i, int h)
|
||||||
|
{
|
||||||
|
i = abs(i);
|
||||||
|
while (i >= h) i = 2 * w - i - 2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Vertical convolution filter that processes vertical strips.
|
||||||
|
__global__ void convolveStrip(float * d_channel, float * d_kernel, int width, int height)
|
||||||
|
{
|
||||||
|
__shared__ float s_kernel[32 * WS];
|
||||||
|
|
||||||
|
// Preload kernel in shared memory.
|
||||||
|
for (int i = 0; i < 32 * WS / TN; i++)
|
||||||
|
{
|
||||||
|
int idx = i * TN + tid;
|
||||||
|
if (idx < 32 * WS) s_kernel[idx] = d_kernel[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
__shared__ float s_strip[32 * WS]; // TN/32
|
||||||
|
|
||||||
|
int wid = tid / 32 - WS/2;
|
||||||
|
|
||||||
|
Mirror wrap;
|
||||||
|
int row = wrap(wid);
|
||||||
|
|
||||||
|
// Preload image block.
|
||||||
|
for (int i = 0; i < 32 * WS / TN; i++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// @@ Apply kernel to TN/32 rows.
|
||||||
|
|
||||||
|
// @@ Load
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
__constant__ float inputGamma, outputInverseGamma;
|
__constant__ float inputGamma, outputInverseGamma;
|
||||||
__constant__ float kernel[MAX_KERNEL_WIDTH];
|
__constant__ float kernel[MAX_KERNEL_WIDTH];
|
||||||
|
Loading…
Reference in New Issue
Block a user