Add BC6 support to nvtt lib and utils.

- Use 3x3 eigensolver for initial fit in ZOH.  Slightly better perf and RMSE than power method.
- Remove use of double precision in ZOH - speeds up by 12%.
- Fixed RGBM encoding that was broken for HDR images.
- Use gamma-2.0 space for RGBM for HDR images (improves precision in darks).
- Use UNORM instead of TYPELESS formats when saving a DX10 .dds file.  The TYPELESS formats break most viewers.
- Cleaned up warnings in ZOH code.
- Command-line utils will warn if you give them an unrecognized parameter.
- Added VS2010 profiling results.
This commit is contained in:
nathaniel.reed@gmail.com
2013-10-25 17:30:55 +00:00
parent 77188a42ac
commit 474239c784
43 changed files with 1610 additions and 1161 deletions

View File

@ -83,6 +83,10 @@ int main(int argc, char *argv[])
{
files.append(argv[i]);
}
else
{
printf("Warning: unrecognized option \"%s\"\n", argv[i]);
}
}
if (files.count() == 0)

View File

@ -261,6 +261,15 @@ int main(int argc, char *argv[])
{
format = nvtt::Format_BC5;
}
else if (strcmp("-bc6", argv[i]) == 0)
{
format = nvtt::Format_BC6;
}
// !!!UNDONE: add BC7 support
/*else if (strcmp("-bc7", argv[i]) == 0)
{
format = nvtt::Format_BC7;
}*/
// Undocumented option. Mainly used for testing.
else if (strcmp("-ext", argv[i]) == 0)
@ -302,6 +311,10 @@ int main(int argc, char *argv[])
break;
}
else
{
printf("Warning: unrecognized option \"%s\"\n", argv[i]);
}
}
const uint version = nvtt::version();
@ -314,7 +327,7 @@ int main(int argc, char *argv[])
if (input.isNull())
{
printf("usage: nvcompress [options] infile [outfile]\n\n");
printf("usage: nvcompress [options] infile [outfile.dds]\n\n");
printf("Input options:\n");
printf(" -color \tThe input image is a color map (default).\n");
@ -340,11 +353,13 @@ int main(int argc, char *argv[])
printf(" -bc3 \tBC3 format (DXT5)\n");
printf(" -bc3n \tBC3 normal map format (DXT5nm)\n");
printf(" -bc4 \tBC4 format (ATI1)\n");
printf(" -bc5 \tBC5 format (3Dc/ATI2)\n\n");
printf(" -bc5 \tBC5 format (3Dc/ATI2)\n");
printf(" -bc6 \tBC6 format\n");
//printf(" -bc7 \tBC7 format\n\n");
printf("Output options:\n");
printf(" -silent \tDo not output progress messages\n");
printf(" -dds10 \tUse DirectX 10 DDS format\n\n");
printf(" -dds10 \tUse DirectX 10 DDS format (enabled by default for BC6/7)\n\n");
return EXIT_FAILURE;
}
@ -581,6 +596,12 @@ int main(int argc, char *argv[])
outputOptions.setOutputHandler(&outputHandler);
outputOptions.setErrorHandler(&errorHandler);
// Automatically use dds10 if compressing to BC6 or BC7
if (format == nvtt::Format_BC6 || format == nvtt::Format_BC7)
{
dds10 = true;
}
if (dds10)
{
outputOptions.setContainer(nvtt::Container_DDS10);

View File

@ -66,6 +66,8 @@ int main(int argc, char *argv[])
if (i+1 == argc) break;
i++;
// !!!UNDONE: Support at least one HDR output format
#ifdef HAVE_PNG
if (strcmp("png", argv[i]) == 0) savePNG = true;
else
@ -92,13 +94,17 @@ int main(int argc, char *argv[])
break;
}
else
{
printf("Warning: unrecognized option \"%s\"\n", argv[i]);
}
}
printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
if (input.isNull())
{
printf("usage: nvdecompress [options] infile [outfile]\n\n");
printf("usage: nvdecompress [options] infile.dds [outfile]\n\n");
printf("Note: the .tga or .png extension is forced on outfile\n\n");
@ -112,6 +118,8 @@ int main(int argc, char *argv[])
}
// Load surface.
// !!! DirectDrawSurface API doesn't support float images, so BC6 will be converted to 8-bit on load.
// Should use nvtt::Surface instead.
nv::DirectDrawSurface dds(input.str());
if (!dds.isValid())
{

View File

@ -182,11 +182,10 @@ int main(int argc, char *argv[])
{
compareNormal = true;
}
if (strcmp("-alpha", argv[i]) == 0)
else if (strcmp("-alpha", argv[i]) == 0)
{
compareAlpha = true;
}
else if (argv[i][0] != '-')
{
input0 = argv[i];
@ -197,6 +196,10 @@ int main(int argc, char *argv[])
break;
}
else
{
printf("Warning: unrecognized option \"%s\"\n", argv[i]);
}
}
if (input0.isNull() || input1.isNull())

View File

@ -131,6 +131,10 @@ int main(int argc, char *argv[])
break;
}
else
{
printf("Warning: unrecognized option \"%s\"\n", argv[i]);
}
}
if (input.isNull() || output.isNull())