Start using refactored fast compressor.
Fix error with DX10 headers.
This commit is contained in:
parent
d1d71dd2b3
commit
a19df8721d
@ -851,6 +851,10 @@
|
||||
RelativePath="..\..\..\src\nvimage\nvtt\OutputOptions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\nvimage\nvtt\QuickCompressDXT.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
@ -893,6 +897,10 @@
|
||||
RelativePath="..\..\..\src\nvimage\nvtt\nvtt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\nvimage\nvtt\QuickCompressDXT.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
>
|
||||
|
@ -967,7 +967,7 @@ uint DirectDrawSurface::faceSize() const
|
||||
|
||||
uint DirectDrawSurface::offset(const uint face, const uint mipmap)
|
||||
{
|
||||
uint size = sizeof(DDSHeader);
|
||||
uint size = 128; //sizeof(DDSHeader);
|
||||
|
||||
if (face != 0)
|
||||
{
|
||||
|
@ -67,9 +67,7 @@ void nv::fastCompressDXT1(const Image * image, const OutputOptions & outputOptio
|
||||
for (uint x = 0; x < w; x += 4) {
|
||||
rgba.init(image, x, y);
|
||||
|
||||
//QuickCompress::compressDXT1(rgba, &block);
|
||||
|
||||
compressBlock_BoundsRange(rgba, &block);
|
||||
QuickCompress::compressDXT1(rgba, &block);
|
||||
|
||||
optimizeEndPoints(rgba, &block);
|
||||
|
||||
|
@ -47,7 +47,7 @@ inline static void extractColorBlockRGB(const ColorBlock & rgba, Vector3 block[1
|
||||
inline static void findMinMaxColorsBox(Vector3 block[16], Vector3 * __restrict maxColor, Vector3 * __restrict minColor)
|
||||
{
|
||||
*maxColor = Vector3(0, 0, 0);
|
||||
*minColor = Vector3(1, 1, 1);
|
||||
*minColor = Vector3(255, 255, 255);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
@ -92,9 +92,9 @@ inline static void insetBBox(Vector3 * __restrict maxColor, Vector3 * __restrict
|
||||
|
||||
inline static uint16 roundAndExpand(Vector3 * v)
|
||||
{
|
||||
uint r = clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f);
|
||||
uint g = clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f);
|
||||
uint b = clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f);
|
||||
uint r = clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f;
|
||||
uint g = clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f;
|
||||
uint b = clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f;
|
||||
|
||||
uint16 w = (r << 11) | (g << 5) | b;
|
||||
|
||||
@ -154,18 +154,18 @@ void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
||||
Vector3 maxColor, minColor;
|
||||
findMinMaxColorsBox(block, &maxColor, &minColor);
|
||||
|
||||
//selectDiagonal(block, &maxColor, &minColor);
|
||||
selectDiagonal(block, &maxColor, &minColor);
|
||||
|
||||
//insetBBox(&minColor, &maxColor);
|
||||
insetBBox(&maxColor, &minColor);
|
||||
|
||||
uint16 color0 = roundAndExpand(&maxColor);
|
||||
uint16 color1 = roundAndExpand(&minColor);
|
||||
|
||||
/*if (color0 < color1)
|
||||
if (color0 < color1)
|
||||
{
|
||||
swap(maxColor, minColor);
|
||||
swap(color0, color1);
|
||||
}*/
|
||||
}
|
||||
|
||||
// @@ Optimize endpoints.
|
||||
|
||||
|
@ -74,6 +74,7 @@ struct Error
|
||||
|
||||
void addSample(float e)
|
||||
{
|
||||
if (fabsf(e) >= 255) nvDebugBreak();
|
||||
samples++;
|
||||
mabse += fabsf(e);
|
||||
maxabse = nv::max(maxabse, fabsf(e));
|
||||
|
Loading…
Reference in New Issue
Block a user